I am generating a jpg image using phantomjs. I want image with 600x400px dimension and 144 dpi/ppi.
But I am only able to generate a image with 72dpi. So, I am trying to generate the image with 1200x800px dimensions in 72 dpi and then resizing it to 600x400px. so my idea is,
1200x800 px has dpi 72
so,
600x400px will have dpi 72*2 = 144 (because 1200/2=600px , 800/2=400px )
I am using java. But whenever I resize my image the quality becomes less.
Approaches I tried :
I tried to manipulate the metadata information of image as explained in the post below, but still it gives image with poor quality.
I tried using AffineTransform as given in following post, still not satisfied with results:
Am I using a wrong approach? If yes, then please suggest some alternatives. If the approach is right then please guide me on how to implement it correctly?
UPDATE
I don't want to reduce the no. of pixels. I want to keep the no. of pixels same but reduce the height/width of image while increasing the dpi. example, In an image of 1200x800px having 72 dpi, I will reduce it to 600x400 px while increasing dpi to 144 . So , if you see the no of pixels are same and the image has higher dpi value.
Finally solved it using itext renderer. Refer to the following post on using itext for scaling the large image to increase resolution.