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
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 (https://exiftool.org/faq.html#Q20) for help with this.
- Phil
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
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=inchesQuoteIn 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
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
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