• Post Reply Bookmark Topic Watch Topic
  • New Topic

JAI rotate leaves 1px black border - why?

DC Dalton
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)

java.io.FileOutputStream stream = new java.io.FileOutputStream(fullOut);
javax.media.jai.RenderedOp in = javax.media.jai.JAI.create("encode", changedImage, stream, "JPEG", null);

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

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!