5

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...

1 Answer 1

7

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 
1
  • 2
    I also had to add -ResolutionUnit=inches because JPEGs produced by Simple Scan didn't even have that. Commented Jul 13, 2019 at 17:11

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.