Use of convert -units

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ChrCoello
Posts: 3
Joined: 2017-04-12T00:23:28-07:00
Authentication code: 1151

Use of convert -units

Post by ChrCoello » 2017-11-09T01:19:08-07:00

Hello,

I am trying to change the resolution unit in the metadata file of a Tiff image.
For my first set of Tiff, the following command seemed to work :

Code: Select all

convert input.tif -units PixelsPerCentimeter ouput.tif
On a second set of images, I encountered that the tiff:REsolutionUnit field is not changed by the -units command:

Code: Select all

chrcoello@cr01:/data/warp/2D/highres_dev$ identify -verbose MR25_s018_WP_meta.tif | grep -E '(Resolution|Units|Print size|Geometry)'
  Geometry: 22500x17500+0+0
  Resolution: 5000x5000
  Print size: 4.5x3.5
  Units: PixelsPerInch
    tiff:ResolutionUnit: 2
    tiff:XResolution: 720000/10000
    tiff:YResolution: 720000/10000
chrcoello@cr01:/data/warp/2D/highres_dev$ convert MR25_s018_WP_meta.tif -units PixelsPerCentimeter test.tif
chrcoello@cr01:/data/warp/2D/highres_dev$ identify -verbose test.tif | grep -E '(Resolution|Units|Print size|Geometry)'
  Geometry: 22500x17500+0+0
  Resolution: 1968.5x1968.5
  Print size: 11.43x8.89
  Units: PixelsPerInch
    tiff:ResolutionUnit: 2
    tiff:XResolution: 720000/10000
    tiff:YResolution: 720000/10000
It seems that the conversion between inches and centimeters was applied to Resolution and Print Size, but that the ResolutionUnit is not changed.

Any advice to overcome this issue ?

Thanks in advance

Christopher

User avatar
fmw42
Posts: 22101
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Use of convert -units

Post by fmw42 » 2017-11-09T10:31:17-07:00

I do not think ImageMagick writes to the tiff: meta data. But I will defer to others who know more about this than I.

You could try EXIFTOOL

Post Reply