Java: Line appears when using AffineTransform to scale image
Posted
by Malakim
on Stack Overflow
See other posts from Stack Overflow
or by Malakim
Published on 2010-03-19T10:49:20Z
Indexed on
2010/03/19
10:51 UTC
Read the original article
Hit count: 307
Hi,
I'm having a problem with image scaling. When I use the following code to scale an image it ends up with a line either at the bottom or on the right side of the image.
double scale = 1;
if (scaleHeight >= scaleWidth) {
scale = scaleWidth;
} else {
scale = scaleHeight;
}
AffineTransform af = new AffineTransform();
af.scale(scale, scale);
AffineTransformOp operation = new AffineTransformOp(af, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
BufferedImage bufferedThumb = operation.filter(img, null);
The original image is here: http://tinyurl.com/yzv6r7h
The scaled image: http://tinyurl.com/yk6e8ga
Does anyone know why the line appears?
Thanks!
© Stack Overflow or respective owner