Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Changing the JPG color parameters in javax.imageio

Thread Tools

Changing the JPG color parameters in javax.imageio

Chris Berg
Posts: n/a
My server, which runs under Java 1.5 wants to convert a .png image
file to .jpg format, to be displayed by an Applet that runs under MS
Java 1.1 VM (IE). (which doesn't support .png).

I use

import javax.imageio.*;
ImageIO.write(, "jpg", outData);

where inData is an InputStream containing the png file, and outData is
an outputStream for the jpg. All goes well; the applet runs fine in
Java 1.5, but when I run it in 1.1, an exception occurs:

sun.awt.image.ImageFormatException: Unsupported color conversion
at sun.awt.image.InputStreamImageSource.doFetch(Compi led Code)
at sun.awt.image.ImageFetcher.fetchloop(Compiled Code)
at Code)

So, it appears that the JPG produced has a color model also not
supported by the MS VM. Strange, 'cause I have never encountered any
other jpg image that it didn't understand.

I also ran it in Sun's Java 1.1.8 Appletviewer by the way, and it
produced the same result.

I suppose i have to play with the javax.imageio.* classes to change
some settings, but it appears to be overwelmingly complicated. Sun's
tutorial also seems quite uninviting. Is it possible to create a JPG
image that the 1.1 applet can understand, without too much effort?


Reply With Quote
Andrew Thompson
Posts: n/a
On Wed, 13 Jul 2005 23:37:21 +0200, Chris Berg wrote:

> My server, which runs under Java 1.5 wants to convert a .png image
> file to .jpg format,

> sun.awt.image.ImageFormatException: Unsupported color conversion

<shot in the monochrome>
Does the .png contain transparent or semi transparent colors?
</shot in the monochrome>

Andrew Thompson
It's Like "Hee Haw" With Lasers
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing font color from current font color to black color Kamaljeet Saini Ruby 0 02-13-2009 04:58 PM
JPG's were nor recognised as JPG's Matthias HTML 5 06-01-2004 11:50 AM
Wrong image size of JPG after TIFF to JPG conversion with JAI Roland Java 0 05-12-2004 03:52 PM
Looking for software to combine 4 JPG images into one JPG image G.M. Durrence Digital Photography 4 04-08-2004 08:04 PM
DSCN1234.JPG vs dscn1234.jpg on COOLPIX 885 Michel Boivin, ing. Digital Photography 0 12-26-2003 06:22 PM