Hi:

I am encountering a very bizarre problem while trying to scale a 16-bit 
UShort image using the AffineTransformOp class.  Basically what happens 
is that, if I create a compatible destination image with the 
createCompatibleDestImage() method,  when I actually call the filter 
method the resulting image has its pixels messed up.  However, if I leave 
it to the filter method (by setting the second arg to null), the pixels 
*look* good, but they are RGB and therefore unusable for any further image 
processing (at least to me).  For some reason the latter method produces a 
TYPE_INT_ARGB image.  Can anyone help me understand this?

Here's the code (where img is being passed in):

double factor           = 0.25;
AffineTransform at      = new AffineTransform();
at.setToScale(factor, factor);
AffineTransformOp op    = new AffineTransformOp(at,AffineTransformOp.TYPE_BILINEAR);
BufferedImage retval    = op.createCompatibleDestImage(img, img.getColorModel());
//
//this one will produce an image of the correct type, but broken
//
BufferedImage result = op.filter(imgs[0], retval );
//
//this one will produce an image that looks good but is of the wrong type:
//
BufferedImage result2 = op.filter(img, retval );


The relevant aspects of the source image are (dumped from the debugger):

colorModel= java.awt.image.ComponentColorModel  (id=46)
imageType= 11
raster= sun.awt.image.ShortInterleavedRaster  (id=61)
    dataBuffer= java.awt.image.DataBufferUShort  (id=64)
    height= 2457    width= 2048    numBands= 1
sampleModel= java.awt.image.PixelInterleavedSampleModel  (id=67)
     dataType= 1     numBands= 1    numBanks= 1     pixelStride= 1     scanlineStride= 
2048

Thanks in advance for your help.

-Carlos Rodriguez

P.S. I can't use JAI.

==========================================================================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