9
I am looking for a way to change the DPI on PNG image files. Using ImageMagick this is easy:
$ convert -density 150 -units pixelsperinch file.png file.png
The problem is that I will run this command from my application, running on multiple VMs, which don't have ImageMagick installed. I can push the upgrade packages to these VMs, but in case of ImageMagick that would add about 30MB to an upgrade bundle, which is a bit too much for my use case.
Long story short: is there a way I can change the DPI on a PNG file using a small (as in package size) command-line tool?
Optionally, changing bytes in a raw image file would be okay too, if someone knows where to look for them...
You might consider doing your own implementation. Manipulating the PNG chunks is straight-forward enough. If you only intend to apply one particular DPI to all of them, you don't even need to have a working checksum function - just copy a pre-made
pHYs
chunk from a PNG made in Photoshop. – Zdenek – 2017-04-22T20:41:26.630