S
sunsetbrew
I have been trying so many things to load in images from mutiple
formats (PNG, GIF, JEPG and TIFF), resize and save them out as JPEG's.
I am currently using JAI to load in the images via a stream. But when
I save them, they sometimes end up corrupt or turn blueish and etc.
This really seems to be a problem with PNG files the most. I have
learned a lot about image formats, but converting images with many
bands and etc seems non-trival. My "almost" successful attempt at
getting a standard format was
public PlanarImage applyRGBFilter(PlanarImage in) {
BufferedImage bufImg = new
BufferedImage(in.getWidth(),in.getHeight(),BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = bufImg.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
g2.drawImage(in.getAsBufferedImage(),0,0,null);
g2.dispose();
return PlanarImage.wrapRenderedImage(bufImg);
}
Any idea??? I have spent over a week trying to figure this out and
reading and searching for data. This post is a last resort for me. I
hope someone can help.
Thanks,
Thomas
formats (PNG, GIF, JEPG and TIFF), resize and save them out as JPEG's.
I am currently using JAI to load in the images via a stream. But when
I save them, they sometimes end up corrupt or turn blueish and etc.
This really seems to be a problem with PNG files the most. I have
learned a lot about image formats, but converting images with many
bands and etc seems non-trival. My "almost" successful attempt at
getting a standard format was
public PlanarImage applyRGBFilter(PlanarImage in) {
BufferedImage bufImg = new
BufferedImage(in.getWidth(),in.getHeight(),BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = bufImg.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
g2.drawImage(in.getAsBufferedImage(),0,0,null);
g2.dispose();
return PlanarImage.wrapRenderedImage(bufImg);
}
Any idea??? I have spent over a week trying to figure this out and
reading and searching for data. This post is a last resort for me. I
hope someone can help.
Thanks,
Thomas