GraphicsMagick - Identify and remove attached color profile

0

I have some tiff images that have an embedded color profile (the example one is Canon EOS-1Ds flash). When I convert them to jpeg (gm convert source.tif target.jpeg) the resulting jpeg colours are distorted in browsers (Chrome,Firefox, but not IE) but not in system image viewers.

If I open the source in GIMP Image Editor, and change the colour profile to sRGB, then the image from the above convert command displays correctly in browsers.

So I have this question:

How can I identify the fact that an image has an embedded color profile using graphicsmagick?

It looks like with this command the profile is removed:

mogrify +profile '*' -define jpeg:preserve-settings

Here is the output from gm identify -verbose source.tif

Image: Di 2007-1337.tif
  Format: TIFF (Tagged Image File Format)
  Geometry: 4053x2257
  Class: DirectClass
  Type: true color
  Depth: 8 bits-per-pixel component
  Channel Depths:
    Red:      8 bits
    Green:    8 bits
    Blue:     8 bits
  Channel Statistics:
    Red:
      Minimum:                     0.00 (0.0000)
      Maximum:                   255.00 (1.0000)
      Mean:                      135.75 (0.5324)
      Standard Deviation:         72.49 (0.2843)
    Green:
      Minimum:                     0.00 (0.0000)
      Maximum:                   255.00 (1.0000)
      Mean:                      129.79 (0.5090)
      Standard Deviation:         72.87 (0.2858)
    Blue:
      Minimum:                     0.00 (0.0000)
      Maximum:                   255.00 (1.0000)
      Mean:                      125.43 (0.4919)
      Standard Deviation:         73.42 (0.2879)
  Resolution: 400x400 pixels/inch
  Filesize: 26.4M
  Interlace: No
  Orientation: Unknown
  Background Color: white
  Border Color: #DFDFDF
  Matte Color: #BDBDBD
  Compose: Over
  Dispose: Undefined
  Iterations: 0
  Compression: No
  Signature: bec78e9402b39f6f5539a640715270a651a39c2238846fa42f37c1c7d99af747
  Profile-color: 219244 bytes
  Profile-iptc: 4358 bytes
    unknown:

    Byline:
  Rod 
    Source:
  Rod 
    Created Date:
  20061006
    Created Time:
  110014+0000
    Originating Program:
  Capture One PRO
    Program Version:
  3.7.1
    unknown:
  0x00000000: ffffff5c 2c3bff65 2dffff39 ffffff55 ff5bff27  ----\,;-e---9---U-[-
  0x00000014: ffffffff ff7affff ffffff48 103a29ff ff17ff58  '-----z-----H-:)----
  0x00000028: ff616363 3dffffff ffffffff ff777a63 6537ff19  X-acc=--------wzce7-
  0x0000003c: ffffffff 3c57ffff ff3c6674 ffff5f67 ff71ffff  -----<W---<
  0x00000050: 74ffff5f 67ff71ff ff00                        ft--_
  Tainted: False
  User Time: 0.030u
  Elapsed Time: 0:01
  Pixels Per Second: 290.8M

The converted image from the following, is broken within OS image viewers as well:

  Format: TIFF (Tagged Image File Format)
  Geometry: 4992x3328
  Class: DirectClass
  Type: true color
  Depth: 8 bits-per-pixel component
  Channel Depths:
    Red:      8 bits
    Green:    8 bits
    Blue:     8 bits
  Channel Statistics:
    Red:
      Minimum:                     0.00 (0.0000)
      Maximum:                   255.00 (1.0000)
      Mean:                      213.55 (0.8374)
      Standard Deviation:         57.03 (0.2237)
    Green:
      Minimum:                     0.00 (0.0000)
      Maximum:                   255.00 (1.0000)
      Mean:                       40.76 (0.1598)
      Standard Deviation:         92.06 (0.3610)
    Blue:
      Minimum:                     0.00 (0.0000)
      Maximum:                   255.00 (1.0000)
      Mean:                      161.49 (0.6333)
      Standard Deviation:        121.23 (0.4754)
  Resolution: 300x300 pixels/inch
  Filesize: 47.6M
  Interlace: No
  Orientation: TopLeft
  Background Color: white
  Border Color: #DFDFDF
  Matte Color: #BDBDBD
  Compose: Over
  Dispose: Undefined
  Iterations: 0
  Compression: No
  Artist: Gary 
  Timestamp: 2006:11:12 12:35:12
  Make: Canon
  Model: Canon EOS-1Ds Mark II
  Software: Adobe Photoshop CS2 Macintosh
  Signature: 1b26f2c2122ea6aa391a40c7eb885d0da120x8e9x5bd7ce0dc7cc9038ba99737
  Profile-iptc: 12926 bytes
    unknown:

    Byline:
  Gary Ombler
    Originating Program:
  Capture One PRO
    Program Version:
  3.7.3
    unknown:
  #Q�$�'���߸︥�[��Rҝ5��n�b����h�
  Profile-XMP: 17293 bytes
  Tainted: False
  User Time: 0.140u
  Elapsed Time: 0:01
  Pixels Per Second: 45.3M
imagemagick
imagemagick-convert
graphicsmagick
color-profile
asked on Stack Overflow Aug 14, 2015 by Giannis • edited Aug 17, 2015 by Giannis

1 Answer

1
gm identify -verbose *.tif | egrep -a '^Image|Profile-'

This will print all matching filenames, followed by the profiles for those files that have them. This would at least let you scan a directory at a time and try to figure out why some files are problematic.

answered on Stack Overflow Oct 8, 2015 by John Vinopal

User contributions licensed under CC BY-SA 3.0