Quick Action: How to change the dpi tags with exiftool
A camera or scanner may embed tags into a photo, that are used as a default resolution for computing the size of the photo when it is displayed or printed.
For example, my iPhone will set these edit tags:
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
We can ignore these tags and print the photos at any size, but sometimes publishers insist on the 300dpi tag to be embedded in a photo. Then it helps to change the Resolution and Y Resolution tags to 300 dpi.
This can be done with exiftool.
- Install exiftool (ExifTool by Phil Harvey), then open a Terminal window.
- Type the command below into the Terminal window and add a space character at the end of the line:
/usr/local/bin/exiftool -overwrite_original_in_place -preserve "-XResolution=300"
Then drag the image file you want to modify from the Finder window directly behind the Terminal command (on the same line) and hit the return key. This will change the X resolution tag. Do the same for the Y resolution:
/usr/local/bin/exiftool -overwrite_original_in_place -preserve "-YResolution=300"
And you may need to change the measurement unit as well to inches:
/usr/local/bin/exiftool -overwrite_original_in_place -preserve "-ResolutionUnit=inches"
I wrapped these commands into an Automator workflow to run them with the "Run Apple Script" action. This workflow can be run from the Finder as a Quick Service. (Only on macOS 10.14 Mojave).
The Quick Action needs an action "Get Selected Finder Items" followed by a "Run Apple Script" action.
Paste this into the Apple Script part:
(* Your script goes here *)
tell application "Finder"
set sel to the selection
set p to sel as alias
set pospath to POSIX path of p
do shell script "/usr/local/bin/exiftool -overwrite_original_in_place -preserve '-XResolution=300' " & pospath
do shell script "/usr/local/bin/exiftool -overwrite_original_in_place -preserve '-YResolution=300' " & pospath
do shell script "/usr/local/bin/exiftool -overwrite_original_in_place -preserve '-ResolutionUnit=inches' " & pospath
-- set the clipboard to pospath
return pospath
end tell
return input
end run
The finished Quick Action should look like this:
Save the Quick Action in the Services folder of the User Library folder.
Enable it as a Finder Quick Action in the System Preferences > Extensions.
Now you can select a photo in the Finder (exactly one photo) and run it from the Quick Action section in the preview of the image (exiftool does not yet work for HEIF images, however):
This user tip was generated from the following discussion: Can I take a 300 dpi photo with my iPhoneX?