How can I change the dpi value recorded in a JPEG file without actually touching anything else, nor recompressing the image?
Linux compatible solutions are welcome.
This 2011 link says we may not have had a tool to do it back then...
How can I change the dpi value recorded in a JPEG file without actually touching anything else, nor recompressing the image?
Linux compatible solutions are welcome.
This 2011 link says we may not have had a tool to do it back then...
You could use exiftool to manipulate EXIF data on different file formats. It's a perl-library accompanied by a command line utility:
$ exiftool test.jpg | grep -i resolution
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Focal Plane X Resolution : 3959.322034
Focal Plane Y Resolution : 3959.322034
Focal Plane Resolution Unit : inches
In this example, EXIF data tells that test.jpg has a resolution of 72×72 dpi. To update this values to e.g. 100×100, exiftool would have to be called like the following:
$ exiftool -XResolution=100 -YResolution=100 test.jpg
1 image files updated
And voilà:
$ exiftool test.jpg | grep -i resolution
X Resolution : 100
Y Resolution : 100
Resolution Unit : inches
Focal Plane X Resolution : 3959.322034
Focal Plane Y Resolution : 3959.322034
Focal Plane Resolution Unit : inches