Resizing Images Results in Image Artifacts
I'm not sure I am posting this in the correct place, but would appreciate suggestions....
I created a simple Java class for a client to resize JPEG images in the current directory but when he uses it, occasionally (7 of 30 images) a black line - either vertical or horizontal - appears on the saved image. He is using Java 1.4.2_07 running on Windows XP.
The scaling is done with:
AffineTransformOp op = new AffineTransformOp( AffineTransform.getScaleInstance(scale, scale), hintlist );
bi = op.filter( bi, null );
Where bi is a loaded BufferedImage, and the result is written back out thusly:
FileOutputStream out = new FileOutputStream(fileName);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi);
if one of these hints are used:
hintlist.put( RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR );
hintlist.put( RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY );
then the resulting image appears as though it was a negative, with a reddish hue.
Any suggestions, pointers, advice would be appreciated!