Yes, I'm not working with GIF but with PNG. My goal is simply to have as exact as possible a scaled image in a second BufferedImage as possible. This does not seem to be possible with the current Graphics2D API. I haven't looked at the JAI API yet, could there be something there to do the trick?
Cheers, Eric
Jim Graham wrote:
Hi Eric, BufferedImage questions are always welcome on the Java2D list.You might have better luck getting the ColorModel, asking it to create you a compatible raster, and then using the BufferedImage constructor that takes a ColorModel and a Raster. But, if the original image was a GIF then the image returned from ImageIO would be an indexed image and you might not want to have a compatible image for the reduced version as that would involve some dithering - so perhaps it isn't always the best solution to request an image in the same format as the original. In this particular case, I'm guessing that you weren't working with a GIF since reading a GIF would not tend to return a CUSTOM image... ...jim --On Monday, March 03, 2003 20:56:18 -0800 Eric Kolotyluk <[EMAIL PROTECTED]> wrote:Where's the border for asking question and posting topics. For quite a while I didn't realize that JAI was a separate package to be downloaded and asked a lot of Graphic2D questions on the JAI list, but got some answers by nice people. But then I noticed that some people were concerned about the types of questions being posted on JAI. Anyway, please let me know which list the following question best belongs in, I have a situation where I need to make a smaller buffered image from a larger one, and I want it to have the same type and colour model, but different dimensions. Can this be done, and if so how? Currently I do something like BufferedImage original = ImiageIO.read(file.png); BufferedImage printable = new BufferImage( (int)(scale * original.getWidth()), (int)(scale * original.getHeight()), BufferedImage.TYPE_3BYTE_BRG); AffineTransform transform = new AffineTransform(); transform.scale(scale, scale); Graphics2D g = printable.createGraphic(); g.drawImage(original, transform, null); The problem is that original is TYPE_CUSTOM and the Java runtime won't let me create a BufferedImage of type custom. Any help would be appreciated. Cheers, Eric
