Hello,

I have an image that is 256 x 256 which I want to scale up to 512 x 512

In the snippet below, origImage is a 256 x 256 BufferedImage

What happens is that in the 512 x 512 rendering area, only the top half (512
X 256) shows any image. The image is enlarged, but it is also 'folded over
on itself'.

            public void paint(Graphics g)
            {
                Graphics2D g2 = (Graphics2D) g;

                AffineTransform scaleTransform = new AffineTransform( );
                scaleTransform.scale(2.0, 2.0);

                AffineTransformOp scaleOp = new
AffineTransformOp(scaleTransform, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);

                BufferedImage scaledImage = new BufferedImage(512, 512,
image.getType( ));

                scaleOp.filter(origImage, scaledImage);

                g2.drawImage(scaledImage, 0, 0, 512, 512, this);
            }

Also, is there a more efficient way to do this. There seem to be a number of
choices and I'm not sure which is the best to pick. The image is gray scale.

Any help would be appreciated.

Thank you,

Ted Hill

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