Thanks Dmitri, I tried this and got the same exception: java.awt.image.ImagingOpException: Unable to transform src image at java.awt.image.AffineTransformOp.filter(AffineTransformOp.java:258) at sun.java2d.SunGraphics2D.renderingPipeImage(SunGraphics2D.java:2165) at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:1626) at sun.awt.image.BufferedImageGraphics2D.drawImage(BufferedImageGraphics2D.java :535) at com.wellogic.carlos.Experiments.ScaleExperiment.main(ScaleExperiment.java:39 )
clearly drawImage is using the same stuff I am using internally. Question for the rest of the list. Is it possible that the problem is that the LUTs are only 200 entries long? -----Original Message----- From: Discussion list for Java 2D API [mailto:[EMAIL PROTECTED]]On Behalf Of Dmitri Trembovetski Sent: Wednesday, November 21, 2001 2:10 PM To: [EMAIL PROTECTED] Subject: Re: [JAVA2D] AffineTransformOp screwiness Hi Carlos, have you tried to scale your image using drawImage with the scale transform set? Something like: BufferedImage dst = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_BYTE_INDEXED, yourIndexedColorModel); Graphics2D g2d = (Graphics2D)dst.getGraphics(); g2d.scale(factor, factor); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2d.drawImage(img, 0, 0, null); Thank you, Dmitri On Wed, Nov 21, 2001 at 01:27:0p -0500, Carlos Rodriguez wrote: > Hi: > > I am having some trouble trying to scale an indexed color image using > AffineTransformOp. > I was wondering if anyone could provide me with some help or point me in the > right direction. The code I am uing is: > > long factor = .25; > AffineTransform at = new AffineTransform(); > at.setToScale(factor,factor); > AffineTransformOp op = new AffineTransformOp(at, > AffineTransformOp.TYPE_BILINEAR); > > BufferedImage res = op.filter(img, null); > end = System.currentTimeMillis(); > > img is an 8-bit indexed color image that I created explicitly using > application data. It hasan IndexColorModel that I populated with the > correct red, green and blue LUTs, and > a DataBufferByte. The useful and informative Exception that is getting > thrown is: > > java.awt.image.ImagingOpException: Unable to transform src image at > java.awt.image.AffineTransformOp.filter(AffineTransformOp.java:258) > > So, can anyone tell me if AffineTransforms are even legal on indexed color > images? I can send the image too if that will help (specify the format, > though...) > > One strange thing is that if I set all LUT's to be the same (i.e, grayscale) > everything works fine. > > > Carlos M. Rodriguez, Senior Systems Engineer > Wellogic, Inc. > 222 Third St. Suite. 2220. Cambridge, MA 02142 > > "Your dependence upon Moore's law is inversely > proportional to your ability as a programmer" > -Buzzword's Corollary to Moore's Law > > =========================================================================== > 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". =========================================================================== 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".
