File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes JAI rotate leaves 1px black border - why? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JAI rotate leaves 1px black border - why?" Watch "JAI rotate leaves 1px black border - why?" New topic

JAI rotate leaves 1px black border - why?

DC Dalton
Ranch Hand

Joined: May 28, 2001
Posts: 287
Im doing some image rotation with the JAI and although its works fabulously I am getting a 1px black border on the top and left of the image when I rotate the image 90 degrees right OR left. When I do a 180 rotate it doesnt appear. Ive done a bunch of reading and can seem to find why this is happening or what I need to adjust to stop it. Here is the code I have so far:

PlanarImage src = JAI.create("fileload", imageName);
float flip = (float)Math.toRadians(angle);
float centerX = src.getWidth() / 2f;
float centerY = src.getHeight() /2f;
ParameterBlock pb = new ParameterBlock();
pb.add(new InterpolationNearest());
PlanarImage changedImage = JAI.create("rotate", pb);

and then Im saving it with this code: (although I dont think this has anything to do with it) stream = new; in ="encode", changedImage, stream, "JPEG", null);

Anyone see what Im doing wrong or (more than likely) something Ive neglected to adjust in the code?

I agree. Here's the link:
subject: JAI rotate leaves 1px black border - why?
It's not a secret anymore!