By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,032 Members | 811 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,032 IT Pros & Developers. It's quick & easy.

Saving a BufferedImage as a JPEG

P: n/a
I am saving a BufferedImage as a JPEG file under Windows XP.
I am using the JAI JPEGImageEncoder class.
The JPEG is saved as CMYK but I need RGB.
I cannot figure out how to get RGB. Any help?
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Michael Johnston" <mi****************@saic.com> wrote in message
news:72**************************@posting.google.c om...
I am saving a BufferedImage as a JPEG file under Windows XP.
I am using the JAI JPEGImageEncoder class.
The JPEG is saved as CMYK but I need RGB.
I cannot figure out how to get RGB. Any help?


Where is the BufferedImage coming from? If you're creating the object
yourself, try using INT_RGB imageType instead of the default ARGB.

image = new BufferedImage(x, y, BufferedImage.TYPE_INT_RGB);

It might also be worth trying this:

JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(image);
encoder.encode(img, param);

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.