In GIMP there is a very simple way to do what I want. I only have the German dialog installed but I’ll try to translate it. I’m talking about going to Picture -> PrintingSize
and then adjusting the Values X-Resolution
and Y-Resolution
which are known to me as so called DPI values. You can also choose the format which by default is Pixel/Inch
. (In German the dialog is Bild -> Druckgröße
and there X-Auflösung
and Y-Auflösung
)
Ok, the values there are often 72
by default. When I change them to e.g. 300
this has the effect that the image stays the same on the computer, but if I print it, it will be smaller if you look at it, but all the details are still there, just smaller -> it has a higher resolution on the printed paper (but smaller size… which is fine for me).
I am often doing that when I am working with LaTeX, or to be exact with the command pdflatex
on a recent Ubuntu-Machine. When I’m doing the above process with GIMP manually everything works just fine. The images will appear smaller in the resulting PDF but with high printing quality.
What I am trying to do is to automate the process of going into GIMP and adjusting the DPI values. Since ImageMagick is known to be superb and I used it for many other tasks I tried to achieve my goal with this tool. But it does just not do what I want.
After trying a lot of things, I think this actually is the command that should be my friend:
convert input.png -density 300 output.png
This should set the DPI to 300, as I can read everywhere in the web. It seems to work. But when I check the file it stays the same (EDIT: which is what I expect, as explained above).
file input.png output.png
input.png: PNG image data, 611 x 453, 8-bit grayscale, non-interlaced
output.png: PNG image data, 611 x 453, 8-bit grayscale, non-interlaced
When I use this command, it seems like it did what I wanted:
identify -verbose output.png | grep 300
Resolution: 300x300
PNG:pHYs : x_res=300, y_res=300, units=0
Funny enough, the same output comes for input.png
which confuses me… so this might be the wrong parameters to watch?
But when I now render my TeX with pdflatex
the image is still big and blurry. Also when I open the image with GIMP again the DPI values are set to 72
instead of 300
. So there actually was no effect at all.
Now what is the problem here. Am I getting something completely wrong? I can’t be that wrong since everything works just fine with GIMP.
Thanks for any help in this. I am also open to other automated solutions which are easily done on a Linux system.
Best Answer
Specify the units - I seem to remember having a problem when I omitted this option (although DPI should be the default), for example:
Do you know which embedded data fields GIMP uses to read the resolution - does it have its own that override the standard ones used by ImageMagick? For example, Photoshop uses
Photoshop:XResolution
andPhotoshop:YResolution
so you have to set these for Photoshop to recognise a density setting (ImageMagick can’t do this - we use ExifTool).