Folks,
How does one use the com.sun.image.codec.jpeg package to create an image
that includes alpha values.  I have an array of Point4f values representing
red,green,blue and alpha.  I have successfully created jpeg images from an
array of Point3f values (rgb only) using a BufferedImage and Raster.  I read
in the JPEGEncodeParam documentation that an alpha rgb BufferedImage will
not map to a valid JFIF stream.  The runtime error occurs on the creation of
a JPEGEncodeParam object:
...jpeg.codec.ImageFormatException: 4 band JFIF files imply CMYK encoding.

Code snibit:

BufferedImage bi = new
BufferedImage(width,height,BUFFEREDIMAGE.TYPE_4BYTE_ABGR);
ColorModel cm = bi.getColorModel();
Raster ra = bi.getAlphaRaster();
//fill raster in a loop
ra.setPixel(x,y,abgr); //where abgr is a 4 byte array
//Create encoder
BufferedOutputStream bos = new BufferedOutputStream(fos);
JPEGImageEncoder jie = JPEGCodec.createJPEGEncoder(bos);
//Create param object using raster and color_id
int cid = jie.getDefaultColorId(cm);
JPEGEncodeParam jep = new JPEGEncodeParam(ra,cid);

Please comment....

Thanks,
Gregg

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to