Unbuffered image to .jpg

I am using a Java bean that the developer said that they would pass me an unbuffered image and to use awt to convert that into a .jpg image. I am having a hard time understanding how to access the unbuffered image and then what to do with it. I know this is Java 101 but can someone give me some pointers? Thanks

hi
below is a simple method which takes Image object as parameter,
converts it into buffered image , also converts it into jpg image and saves it to hard disk.
this might help you.
public void save(Image img)
BufferedImage bi = new BufferedImage(
img.getWidth(null),
img.getHeight(null),
BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = bi.createGraphics();
g2.drawImage(img, null, null);
FileOutputStream out = null;
try
out = new FileOutputStream("c:/temp/one.jpg");
catch (java.io.FileNotFoundException io)
System.out.println("File Not Found");
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi);
param.setQuality(0.5f,false);
encoder.setJPEGEncodeParam(param);
try
encoder.encode(bi);
out.close();
catch (java.io.IOException io)
System.out.println("IOException");

Similar Messages

  • Error message when uploading book for printing. All images are jpg and rgb. Could they be too large to upload? What size is required and how do I reduce size in Aperture?

    I receive an error message when I upload my book for printing. Not sure what the problem is. All my images are jpg and rgb. Could they be too large as it takes about 15minutes to upload to Apple. How do I reduce the size of the image in Aperture?

    Hi Leonie,
    Thanks for your reply.
    Error message below. The preview is fine . I can discount the first 2messages as its a new computer so plenty of disk space and upload doesn't seem to be interrupted. I have uploaded to iphoto before. have tried to upload 3times with the same error message. I had to photo my slides with a Kaiser Baas photo maker , which apparently doesn't scan but takes photos in megapixels of the slides. I am wondering now if the format is incompatible though they are jpg files or the colour type wrong. The image files are  around 1-3 mb each and  72 ppi. I think  I will now scan them properly with a scanner to 300dpi anyway to improve quality.
    Apple  talks about image files not being too big for uploading but gives no sizing of what too big is?
    Error message
    1. Upload Error. Loss of connection or file corruption during order upload may cause an incomplete order. Resubmitting your order usually resolves this issue.
    2. Low Disk Space. If your computer is running on low disk space, your files may be assembled incorrectly. Create more space by deleting unused files.
    3. Unreadable PDF file or image files. Files are sometimes assembled incorrectly due to CMYK or Grayscale color space. Use the RGB color space for best results.

  • Problem in saving image to jpg

    Hello.
    I've got a problem in saving a LabView Picture in a jpg File.
    The picture id grabbed from a DirectX Livestream from a camera.
    Then I want to save it in a jpg file using the Standard LabView Functions.
    But all I get is an empty jpg File and an error:
    Check_Data_size.vi
    Error 1
    I'm using LabView 7.1.
    Has anybody got an idea how to solve the problem?

    No.  You can save a gray image to jpg, but I has to be 24 bit.
    Try save your data to bmp.  If you got the same problem, that means you fail to wire correct data format to the LabVIEW VI you're using.
    George Zou
    http://gtoolbox.yeah.net
    George Zou
    http://webspace.webring.com/people/og/gtoolbox

  • Converting GIF images to JPG - display problems in browser

    I am currently writing a program that uses the ImageIO package (javax.imageio.*) to take GIF and PNG images and convert them to JPG images. The program seems to convert them correctly, especially for the PNG images, but the converted GIF images don't open in a browser. They open just fine in Windows Picture and Fax viewer, but when I try to open them in IE or Firefox, it only diplays the little red 'x'.
    Is anyone familiar enough with Images and the ImageIO package in Java that they may have some insight on why these converted GIF files won't display in a browser.

    Bonjour,
    In my [website|http://iweb.debutersurmac.com>, all the images are JPG files,
    By default iWeb '09 converts images to JPG (yes, it's true)...
    ...unless you use masked images*
    !http://i32.servimg.com/u/f32/09/02/44/99/masked10.jpg!
    Crop your images (with Preview) before you paste them in iWeb. Don't use mask, Unmask an image if it's masked. That's the trick!
    !http://i32.servimg.com/u/f32/09/02/44/99/unmask10.jpg!
    (* images with transparency areas (ex : some PNG and GIF), rotation and shapes in iWeb make also PNG files in your website.)

  • How do I resave RAW images as JPG?

    I have been taking all my photos in Nikon's RAW format and Leica's RAW format. For archival and exporting purposes I would like to resave some of these projects in JPG (leaving the orignal RAW format projects in tact). I'm guessing that this is easy to do - but it's not apparent to me.
    Thanks

    You want to save the images as JPG where? back in Aperture? to some external location?
    What you asking doesn't make sense from an Aperture standpoint. Your RAW images can be exported as JPG at anytime by doing an export version command. Thereis no way to turn a RAW image into a JPG and have it stored in Aperture without exporting the version and then re-importing it. But then it will have no connection to the original master it came from.
    So if you could explain ain more detail what it is you are trying to do we might be able to come up with an answer.
    regards

  • Why won't my trial of CC Photoshop let me save my PSD images as JPG or GIF?

    Why won't my trial of CC Photoshop let me save my PSD images as JPG or GIF?

    One thing to check is that your PSD is RGB/8 or /16, but not /32  (32 bits per channel)
    If that is not the problem
    Let's try this:
    Close Adobe Photoshop if it is opened.
    Find the following:   (windows user can hit windows key + r, then in run cmd line type "%appdata%" to locate your "AppData\Roaming" directory)
    \AppData\Roaming\Adobe\Adobe Photoshop CC\Adobe Preferences CC Settings
    Rename the  "Adobe Preferences CC Settings" folder to "Adobe Preferences CC Settings_old"  so that preferences settings can be recreated.
    Reopen Photoshop CC and open a new or existing file to verify that your "save for web" option is back and not grayed out.

  • Nikon NEF images to JPG

    Is there a way in iPhoto or other recommended method for converting Nikon's NEF (RAW) images to JPG? Please copy responses to [email protected]
    Thanks

    Hi roqinman,
    When you import the NEF files into iPhoto, iPhoto creates a jpeg of each RAW file.
    The photos you are viewing in the Library are actually the jpeg files that were created by iPhoto. The RAW files are tucked away safe in the Originals folder for that date of import.
    This is a view of how the iPhoto Library looks in the Finder.
    It is organized by Year folders. Inside the Year folders are Month folders. Inside the Month folders are the days of the Month. Inside the day folders are the photos you took on that day. If you imported video clips and RAW files on that day they will be in an Originals folder. If you have edited any photo imported on that day, the original will be in that folder also.

  • Photoshop saves images as jpg.lnk.  How do I stop that?  I just want jpg.  Cannot email jpg.lnk.

    In Photoshop I save an image as jpg, but it saves as jpg.lnk.
    This is a file that cannot be emailed.  It gets blocked as a dangerous file.
    How do I eliminate the ltd?
    Thank you,

    Hi,
    Only saw it in Outlook.
    Thats the only place it would show the file as jpg.lnk instead of just jpg.
    On Thu, Jan 29, 2015 at 7:16 AM, Silkrooster <[email protected]>

  • Coverting Raw images to JPG

    I'm wondering if someone knows how to convert the raw images into jpg, but still keep the RAW images. I need to use the jpg images for iWeb so the website can load up a lot quicker.
    Thanks

    Shiftyoz:
    Welcome to the Apple Discussions. I don't use RAW but I believe iPhoto creates a jpg for viewing and editing (the RAW file is left untouched). So if you export the file to the desktop via the File->Export->File Export menu option you'll be able to select the file format and a reduced size (if desired).
    Do you Twango?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.

  • Save image as .jpg in the photoshop CC

    I was using Photoshop CS6 so I instaled Photoshop CC. Now I need to  save my images as .jpg in the photoshop but I don't know how to do it. May someone  help  me, please?

    It works the same as CS6. You can use save as or save for web. Just make sure your document mode is in RGB 8-bit. Otherwise you can not find jpg in the file types.
    Actually, either CS6 or CC they updated the jpg option so that it would convert a 16-bit image to 8-bit for you. But for reference, the file format it self only supports RGB 8-bit.

  • Converting a image file (JPG or BMP or any other) to an Image object

    Hello, does anyone have an idea of how I could convert a image file (JPG, BMP, GIF or any other) or even a Corel Draw (.CDR) file to a java Image object?
    Thanks in advance
    Wilson

    Demo:
    import java.awt.image.*;
    import java.io.*;
    import java.net.*;
    import javax.imageio.*;
    import javax.swing.*;
    public class ImageResized {
        public static void main(String[] args) throws IOException {
            URL url = new URL("http://today.java.net/jag/bio/JagHeadshot.jpg");
            BufferedImage image = ImageIO.read(url);
            Icon icon = new ImageIcon(image);
            JLabel label = new JLabel(icon);
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(label);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • Comic project part 1:Need to pop. an array with 100 images(001.jpg-100.jpg)

    Hi guys. I am trying to break down my project logically. In the first part, I need to populate an array with 100 images, named 001.jpg through 100.jpg. Any takers?

    Well, I dont think its quite as complicated as it might seem. I dont want to build a comic reader that lets you download new titles. I want to build a page flipper that lets me flip back and forth between 100 images. Back button, forward button, website button in middle on the bottom.
    My goal is to post the completed code online for artists to use. I will see my comic start to finish to make sure it works. Then I will do another and finish the documentation (which goes from signing up as a developer, signing up the itunes connect banking information, and finishes with submitting the app). I want to provide artists with an easily customizable framework upon they can drop their comic images appropriately named into the project folder, and compile.
    Its a glorified slideshow, only one that requires a button push to advance. This way artists can be artists, not programmers. I had swiping as the interface (I have a 90% functional app, but there are changes that need to be made. Not a lot, but enough that I have to keep asking questions) until I realized that the comic can be read one handed, so I am moving to buttons! Doh!
    There wont be any updating. Each issue is self contained.
    Another issue with my sample code: it is set up now where I can name the images "image001.jpg" "image002.jpg" etc. This is a little cumbersome. I am hoping the array method will allow for the code to pull the images, and no one will have to trouble shoot 100 image names to find problems. I hope I am not being unclear in my explanation. Thanks for your kind words. My app works as is. But artists will immediately see the shortcomings. If I can fix only one or 2 small issues, it will be good enough for thousands of artists to pick up and use to sell comics. I have the source code for anyone that wants to take a look.

  • Dreamweaver CSS Mac writes image links wrong... img src="/www/images/asian_sales_office.jpg"

    Dreamweaver CSS Mac writes image links wrong... <img src="/www/images/asian_sales_office.jpg" width="x" height="x" alt="x"> Took me a bit to find this, now back to hand coding all image links and also checking other code. Any fixes?

    That looks to me like you may have your site definition set up incorrectly and you appear to be using "Site Root Relative" vs "Document Relative"
    Go to Site > Manage Sites > click the  site you are working on > Click the Edit icon > Advanced Settings > Links relative to: should be set as Document, unless you have a very specific reason for choosing Site Root there
    If your server root folder is called www, you'll need to remove that folder from your site root. You are only transferring files from root to root, so the name of your local root folder is not important (the files inside it go to the server root). It is important not to accidentally have a duplicate of the server root folder inside your local root though which would accidentally nest your files within another folder when transferring to the server.

  • Beta 2 - mx:GridItem backgroundImage="images/caribbean.jpg"

    I am wondering about the changes to beta.   I installed beta 2, and the following code doesn't seem to work now.  I am not getting an error for this,
    <mx:GridItem backgroundImage="images/caribbean.jpg" >
              <s:Button id="CariButton" alpha=".5" label="CARIBBEAN" width="100" height="30" fontSize="10"
                             click="Carb_click(1)" />
    </mx:GridItem>
    This worked fine in Beta 1, also the intellisense  doesn't display backgroundImage as an option now when I am coding in the GridItem tag.   The backgroundAttachment option is still there, which relates to backgroundImage.   Just wondering what is the property now to load a backgroundImage in a griditem cell ?  I apologize if I miss this posted somewhere already, but I did check =).
    Thanks
    Elgin

    I am currently using <s:HGroup and <s:VGroup  quite abit.  I was using  <mx:grid because it is easy to format, very similar to <Table></Table>.    I can see with embedding Groups you could get the same effect as a grid.   It was just easier with my limited knowledge of flex to format a Grid and get the look I was looking for.
    In the app I am changing the Alpha of a button when it is selected to display the background Image of the GridItem that holds the buton.
    Here is a screenshot of how I was using Grid.   And you can see the buttons to the left.
    Thanks again,
    Elgin

  • How can i convert CR2 images into jpg format, without iPhoto?

    i just import a lot of images with the format .CR2 to mac through "Image capture" is there an app to convert the frmat into .jpg, app like image capture or something like that?

    If Canons software doesn't work...?
    Try Snap Converter, File Juicer or Contenta Converter

Maybe you are looking for

  • FlashPlayerPlugin_12_0_0_77.exe*32 CPUs with FF v26-2828.

    FlashPlayerPlugin_12_0_0_77.exe*64 CPUs. Firefox at 369,616 K FlashPlayerPlugin at 1,550,628 K and 51% CPU. Firefox extremely sluggish. This has been happening for about 6 months with very new release of Flash and Firefox. Makes Firefox unusable. Fix

  • Ipod classic and Samsung

    Is there a way to connect my Ipod classic to a Samsung Tv to watch videos AND play my music? Does the new Apple dock work with Samsung?

  • ?'s About Transitioning from Bridge to LR

    I have a couple of questions before installing LR and importing work already done through Bridge. I searched the archives but didn't see exactly what I'm looking for - apologies in advance if I missed it. 1) I have been reading about using stacks, "v

  • Unable to send emails with photo attachment

    Email messages containing photo's will notes deform my iPad. I am able to receive messages with attachments.

  • Elitebook 8730 unable to find web cam

    Windows 7 Elitebook 8730  FN034UT#ABA no web cam listed in bios after replacing hard drive and reinstalling using disks supplied by HP. Attempt to install webcam software results in web cam not found message.