Page 1 of 1

Use of convert -units

Posted: 2017-11-09T01:19:08-07:00
by ChrCoello
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

Re: Use of convert -units

Posted: 2017-11-09T10:31:17-07:00
by fmw42
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