Author Topic: Change Image Resolution without re-save files  (Read 9089 times)

ame

  • Jr. Member
  • **
  • Posts: 12
Change Image Resolution without re-save files
« on: December 09, 2013, 08:37:30 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 19187
    • ExifTool Home Page
Re: Change Image Resolution without re-save files
« Reply #1 on: December 09, 2013, 09:01:49 AM »
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:

Code: [Select]
> 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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ame

  • Jr. Member
  • **
  • Posts: 12
Re: Change Image Resolution without re-save files
« Reply #2 on: December 09, 2013, 09:42:51 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 19187
    • ExifTool Home Page
Re: Change Image Resolution without re-save files
« Reply #3 on: December 09, 2013, 10:03:55 AM »
Hi Ame,

I need also to define Units (inches…) or not?

Yes.  Good point.  -resolutionunit=inches

Quote
In 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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ame

  • Jr. Member
  • **
  • Posts: 12
Re: Change Image Resolution without re-save files
« Reply #4 on: January 21, 2014, 12:37:01 PM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 19187
    • ExifTool Home Page
Re: Change Image Resolution without re-save files
« Reply #5 on: January 21, 2014, 12:48:49 PM »
Hi Stefano,

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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).