Thanks Jim!

That's how my latest code looks like, i simplified it a lot:

param.setSourceBands(new int[] {0, 1, 2});
param.setDestinationType(
ImageTypeSpecifier.createPacked(ColorSpace.getInstance(ColorSpace.CS_sRG B),
0x00ff0000,
0x0000ff00,
0x000000ff,
0x0,
DataBuffer.TYPE_INT,
false
)
);


But it still produces the same problems. The resulting jpeg files are strange, don't display correctly in some viewers and get much bigger in size than necessary.

If I use the workaround of copying the TYPE_INT_ARGB BufferedImage into a TYPE_INT_RGB BufferedImage and then generate the JPEG by just using the default settings, everything works fine.

It looks to me as if there is a bug in the JPEG codec.

What do you think?

Jürg

Am 17.03.2004 um 01:55 schrieb Jim Graham:

An image of TYPE_INT_ARGB uses a PackedColorModel with a Packed
Raster with a TYPE_INT DataBuffer.  It is incompatible with the
Byte-based ComponentColorModel (and SampleModel) that you are
creating.  I'm not sure how these two pieces of data would
interact in this case...

...jim

--On 03/15/04 22:40:12 +0100 Jürg Lehni wrote:
if (bi.getType() == BufferedImage.TYPE_INT_ARGB) {
        // create a new ColorModel with OPAQUE transparency and no
alpha channel.
        ColorModel cm = new
ComponentColorModel(bi.getColorModel().getColorSpace(), false, false,
Transparency.OPAQUE, DataBuffer.TYPE_BYTE);

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



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

Reply via email to