I have following code to convert a big image to smaller thumbnail,
it work's fine until one day this image come out
http://www.here4now.com/mobdata/sunb...Untitled-2.gif
The original size is 200x205, if I resize it to 101x103, it looks
still fine, but one pixed smaller , say 100x102, the result image is
total unacceptable.
Any help or hint will be appreciate
Ivan Wang
P.S. I didn't use Image.getScaledInstance to resize the image because
our server don't have X-window installed.
/************************************************** *****************/
public static void resize(String file1, String file2){
source = JAI.create("fileload", file1);
ParameterBlock pb = new ParameterBlock();
pb.addSource(source);
pb.add(null).add(null).add(null).add(null).add(nul l);
RenderableImage ren = JAI.createRenderable("renderable", pb);
pb = new ParameterBlock();
pb.addSource(ren);
int w = source.getWidth()/2;
int h = source.getHeight()/2;
//RenderingHints renderingHints = new RenderingHints( null );
//renderingHints.put( RenderingHints.KEY_COLOR_RENDERING,
// RenderingHints.VALUE_COLOR_RENDER_QUALITY );
PlanarImage dst = (PlanarImage)ren.createScaledRendering(w, h,
null);
JAI.create("filestore",dst,file2,"PNG");
}
/************************************************** *****************/