C
Chris Berg
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(ImageIO.read(inData), "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
request
at
sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:125)
at sun.awt.image.InputStreamImageSource.doFetch(Compiled Code)
at sun.awt.image.ImageFetcher.fetchloop(Compiled Code)
at sun.awt.image.ImageFetcher.run(Compiled 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?
Chris
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(ImageIO.read(inData), "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
request
at
sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:125)
at sun.awt.image.InputStreamImageSource.doFetch(Compiled Code)
at sun.awt.image.ImageFetcher.fetchloop(Compiled Code)
at sun.awt.image.ImageFetcher.run(Compiled 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?
Chris