News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Change Image Resolution without re-save files

Started by ame, December 09, 2013, 08:37:30 AM

Previous topic - Next topic

ame

In some "normalization" batch I would like to, instead of re-save JPEG files, change only resolution setting it to standard 300 ppi or other values.
Files come from around the world, so they can be generated by any software.
Same thing I would like to apply to TIFF and PSD files.

I found on google some post.
I don't know exactly in how many place the resolution value must be changed.
I would like a method that can change res in both JPEG, TIFF and PSD file formats.
For example the following command return me error (the file monet.jpeg has 300 ppi recognized from Photoshop and 96 ppi recognized in JFIF header using Apple Preview).

exiftool -Xresolution=300 -Yresolution=300 -jfif:Xresolution=300 -jfif:Yresolution=300 /Users/adminosx/Desktop/google_monet.JPG
Error: Error reading StripOffsets data in IFD0 - /Users/adminosx/Desktop/google_monet.JPG

Any suggestion/help? It is possible to have one command line that normalize the res on all formats explained.

Ame

Phil Harvey

Hi Ame,

you don't need to write JFIF:Xresolution/YResolution separately.  Specifying just -XResolution=300 will change the JFIF (and other) values if they exist:

> exiftool a.jpg -xresolution=300 -v2
Writing JFIF:XResolution if tag exists
Writing Photoshop:XResolution if tag exists
Writing XMP-tiff:XResolution if tag exists
Writing IFD0:XResolution
...


The error you are getting is due to improperly formatted EXIF information.  See FAQ 20 for help with this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ame

Hi Phil,

Thanks for the answer. I need also to define Units (inches...) or not?

In case of error I should move image in a errImages folder or deleting all metadata and try to set again the resolution?

Ame

Phil Harvey

Hi Ame,

Quote from: ame on December 09, 2013, 09:42:51 AM
I need also to define Units (inches...) or not?

Yes.  Good point.  -resolutionunit=inches

QuoteIn case of error I should move image in a errImages folder or deleting all metadata and try to set again the resolution?

You don't need to move the image because ExifTool will create a backup of the original image for you.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ame

Hi Phil,

I read the FAQ 20. It apply only to JPEG files or also to TIFF and PSD files the possibility to clean and rebuild image?

In short example, the pathPosixImmagine can be a JPEG, TIFF or PSD, so when go in error the images is cleaned and again exiftool try to change the resolution.
If for any reason the process goes again in error the image is signed as "damaged".
I can manage this only with JPEG or I can with other files types?

try
      do shell script "/usr/bin/exiftool -overwrite_original -xresolution=254 -yresolution=254 -resolutionunit=inches " & quoted form of pathPosixImmagine
   on error msg number errnum
      try
         do shell script "/usr/bin/exiftool -overwrite_original -all= -tagsfromfile @ -all:all -unsafe " & quoted form of pathPosixImmagine
         do shell script "/usr/bin/exiftool -overwrite_original -xresolution=254 -yresolution=254 -resolutionunit=inches " & quoted form of pathPosixImmagine
      on error msg number errnum
         display dialog "this image is damaged"
      end try
   end try


Thanks in advance

Stefano

Phil Harvey

Hi Stefano,

Quote from: ame on January 21, 2014, 12:37:01 PM
I read the FAQ 20. It apply only to JPEG files or also to TIFF and PSD files the possibility to clean and rebuild image?

Right.  ExifTool can not be used to fix errors in TIFF or PSD files.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).