confused about image dpi.
Hi,
I have been using
ImageIO.write(wheelImage,"png",new File(fileName));
to create images which are then used on web pages. I then wanted to create the same image files but with a higher resolution so that I can use them for printing ( the images I printed out from the files created with the above method were a bit fuzzy ).
So I looked into JAI, and used this code to try to produce higher resolution images:
if (highResolution){
// these two lines should switch the resolution to 300 dpi
PNGEncodeParam png = PNGEncodeParam
.getDefaultEncodeParam(wheelImage);
png.setPhysicalDimension(11811, 11811, 1);
}
JAI.create("filestore", wheelImage, fileName,"png");
The only difference I see is that using JAI, I get image files about 1/3 bigger than using ImageIO, and I don't see any difference in quality. The code within the 'if' statement seems to make no difference.
Can someone help please - I'm floundering!
Thanks,
John Pedersen
[1263 byte] By [
pir8ped8a] at [2007-11-27 3:41:56]

# 1
I can tell you that just increasing the resolution of an image won't make the picture sharper. In fact, I can imagine it might even make it more blurry.
Let's use an example to explain this. Say you have an image at 200 DPI. That's 200 dots per inch. And your image is 5x5" (inches). That means you will have an image that is 1000x1000 pixels (5" x 200 DPI = 1000). If you were to increase this image to 300 DPI, you will still have a 5x5" image, but it will be 1500x1500 pixels.
That means you will have an additional 500 pixels that previously didn't contain any data, that now need to be populated with some sort of information. The best any algorithm can do is guess what each pixel should be based on the surrounding pixels.
Aside from the technicalities of what's going on, I can't be of much further help. You will need to find a good algorithm that will guess what each new pixel in the higher resolution image should be. I don't know of any algorithms.
Hope I could be of some help though,
CowKing