Page 1 of 1

Always ignores icc profile :(

Posted: 2017-10-24T07:24:19-07:00
by vladimir.mavrodiev
Hi guys,
I hope that this is the right place for this, sorry if not :) Here's the problem that I have:

I'm with the latest version of the package (Version: ImageMagick 6.7.7-10) that came with

Code: Select all

DELEGATES     bzlib djvu fftw fontconfig freetype jbig jpeg jng jp2 lcms2 lqr lzma openexr pango png rsvg tiff x11 xml wmf zlib
And the processed images are always with no icc profile inside. No matter If I try to keep an existing profile, or set another one - the result has none (always stripping them?). I tried this both with the php extension and with a simple command line like convert test.png -profile "test.icc" test2.png.
I read a lot on the issue and understand that I need this LittleCMS lib, but is only lcms2 enough, or do I need lcms (ver.1?) also?

I don't know what am I missing... I would appreciate if someone could help :)

Re: Always ignores icc profile :(

Posted: 2017-10-24T09:02:39-07:00
by snibgo
vladimir.mavrodiev wrote:I'm with the latest version of the package (Version: ImageMagick 6.7.7-10) that came with
That is a very old version. I suggest you upgrade to the current version, eg 6.9.9-20 if you have many v6 scripts, otherwise the latest v7.

I don't know if lcms2 is sufficient to use profiles.

Re: Always ignores icc profile :(

Posted: 2017-10-24T10:51:01-07:00
by fmw42
I use lcms2 and it works fine for me on Mac OSX. IM 6.7.7.10 was a release during which there were considerable changes to IM with regard to colorspace. So as snibgo said, you would be best to upgrade to the most current version you can.

What is your platform?

Does test.png already have a profile? What is test.icc? I have never heard of that. Do you mean sRGB.icc?

Re: Always ignores icc profile :(

Posted: 2017-10-24T17:02:15-07:00
by fmw42
What is the date associated with your IM 6.7.7.10 version and your OS? If on Linux, some variants of Linux try to patch ImageMagick without changing the version number. Perhaps the patch is bad or it has not been patched to the latest patch.

Re: Always ignores icc profile :(

Posted: 2017-10-24T17:08:54-07:00
by fmw42
Adding a profile works fine for me in IM 6.7.7.10 Q16 Mac OSX Sierra

convert -list configure | grep "DELEGATES"
DELEGATES bzlib fftw fontconfig freetype gs jbig jpeg jng jp2 lcms2 lqr lzma mpeg openexr png rsvg tiff x11 xml zlib

convert logo: logo.png

Code: Select all

Properties:
    date:create: 2017-10-24T17:03:27-07:00
    date:modify: 2017-10-24T17:03:27-07:00
    png:bKGD: chunk was found (see Background color, above)
    png:cHRM: chunk was found (see Chromaticity, above)
    png:gAMA: gamma=0.45454544 (See Gamma, above)
    png:IHDR.bit-depth-orig: 8
    png:IHDR.bit_depth: 8
    png:IHDR.color-type-orig: 3
    png:IHDR.color_type: 3 (Indexed)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 640, 480
    png:PLTE.number_colors: 256
    png:sRGB: intent=0 (Perceptual Intent)
    png:text: 2 tEXt/zTXt/iTXt chunks were found
    png:tIME: 2017-10-24T10:03:27Z
    signature: 5c701306a9a985a0c93c8d11a1e761d7f8637577697fc60d7189b221388f8edf
  Artifacts:
    filename: logo.png
    verbose: true
convert logo.png -profile /Users/fred/images/profiles/sRGB.icc logo_profile.png

Code: Select all

 Properties:
    date:create: 2017-10-24T17:04:00-07:00
    date:modify: 2017-10-24T17:04:00-07:00
   [color=#FF0000] icc:copy right: sRGB built-in
    icc:description: sRGB built-in
    icc:manufacturer: (lcms internal)
    icc:model: sRGB built-in[/color]
   png:bKGD: chunk was found (see Background color, above)
    png:cHRM: chunk was found (see Chromaticity, above)
    png:iCCP: chunk was found
    png:IHDR.bit-depth-orig: 8
    png:IHDR.bit_depth: 8
    png:IHDR.color-type-orig: 3
    png:IHDR.color_type: 3 (Indexed)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 640, 480
    png:PLTE.number_colors: 256
    png:text: 6 tEXt/zTXt/iTXt chunks were found
    png:tIME: 2017-10-24T10:03:27Z
    signature: 5c701306a9a985a0c93c8d11a1e761d7f8637577697fc60d7189b221388f8edf
  Profiles:
[color=#FF0000]    Profile-icc: 6876 bytes
[/color]  Artifacts:
    filename: logo_profile.png
    verbose: true

Re: Always ignores icc profile :(

Posted: 2017-10-25T02:19:55-07:00
by vladimir.mavrodiev
Hello again,
Thanks for the quick responses :) So... I'm on Ubuntu 14.04.5 LTS and with IM - Version: ImageMagick 6.7.7-10 2017-07-31 Q16. I removed and installed it from scratch again yesterday with sudo apt-get install imagemagick and I think somewhere it said this is the latest version for my ubuntu...
apt list --installed imagemagick* returns:

Code: Select all

Listing... Done
imagemagick/trusty-updates,trusty-security,now 8:6.7.7.10-6ubuntu3.9 amd64 [installed]
imagemagick-common/trusty-updates,trusty-security,now 8:6.7.7.10-6ubuntu3.9 all [installed,automatic]
and convert -list configure returns:

Code: Select all

Path: /usr/lib/x86_64-linux-gnu/ImageMagick-6.7.7/config/configure.xml

Name          Value
-------------------------------------------------------------------------------
CC            gcc -std=gnu99 -std=gnu99
CFLAGS        -I/usr/include/lqr-1 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -fopenmp -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -pthread
CODER_PATH    /usr/lib/x86_64-linux-gnu/ImageMagick-6.7.7/modules-Q16/coders
CONFIGURE     ./configure  '--disable-silent-rules' '--prefix=/usr' '--libdir=${prefix}/lib/x86_64-linux-gnu' '--sysconfdir=/etc' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security' 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security' 'FFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4' 'GCJFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro' '--with-modules' '--with-gs-font-dir=/usr/share/fonts/type1/gsfonts' '--with-magick-plus-plus' '--with-djvu' '--with-wmf' '--without-gvc' '--enable-shared' '--without-dps' '--without-fpx' '--with-perl-options=INSTALLDIRS=vendor' '--x-includes=/usr/include/X11' '--x-libraries=/usr/lib/X11'
CONFIGURE_PATH /etc/ImageMagick/
COPYRIGHT     Copyright (C) 1999-2012 ImageMagick Studio LLC
CPPFLAGS      -I/usr/include/ImageMagick
CXX           g++
CXXFLAGS      -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
DEFS          -DHAVE_CONFIG_H
DELEGATES     bzlib djvu fftw fontconfig freetype jbig jpeg jng jp2 lcms2 lqr lzma openexr pango png rsvg tiff x11 xml wmf zlib
DISTCHECK_CONFIG_FLAGS 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security' 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro' --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-dps=no --with-fpx=no --with-gslib=no --with-fontpath= --with-gs-font-dir=/usr/share/fonts/type1/gsfonts --with-gvc=no --with-perl=no
DOCUMENTATION_PATH /usr/share/doc/ImageMagick-6.7.7
EXEC-PREFIX   /usr
EXECUTABLE_PATH /usr/bin
FEATURES      OpenMP
FILTER_PATH   /usr/lib/x86_64-linux-gnu/ImageMagick-6.7.7/modules-Q16/filters
HOST          x86_64-unknown-linux-gnu
INCLUDE_PATH  /usr/include/ImageMagick
LDFLAGS       -L/usr/lib/x86_64-linux-gnu -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/X11
LIB_VERSION   0x677
LIB_VERSION_NUMBER 6,7,7,10
LIBRARY_PATH  /usr/lib/x86_64-linux-gnu/ImageMagick-6.7.7
LIBS          -lMagickCore -llcms2 -ltiff -lfreetype -ljpeg -llqr-1 -lglib-2.0 -lfftw3 -lfontconfig -lfreetype -lXext -lSM -lICE -lX11 -lXt -llzma -lbz2 -lz -lm -lgomp -lpthread -lltdl
NAME          ImageMagick
PCFLAGS       -fopenmp
PREFIX        /usr
QuantumDepth  16
RELEASE_DATE  2017-07-31
SHARE_PATH    /usr/share/ImageMagick-6.7.7
SVN_REVISION  8535
TARGET_CPU    x86_64
TARGET_OS     linux-gnu
TARGET_VENDOR unknown
VERSION       6.7.7
WEBSITE       http://www.imagemagick.org

Path: [built-in]

Name          Value
-------------------------------------------------------------------------------
NAME          ImageMagick
I do see lcms2 both in LIBS and DELEGATES, so I believe that should be ok...
That test.icc is actually sRGB_IEC61966-2-1_no_black_scaling.icc, that I downloaded from color.org and just renamed it to test with...
test.png has a profile (ProPhoto RGB), here is identify -verbose test.png:

Code: Select all

Image: test.png
  Format: PNG (Portable Network Graphics)
  Class: DirectClass
  Geometry: 1920x685+0+0
  Resolution: 28.35x28.35
  Print size: 67.7249x24.1623
  Units: PixelsPerCentimeter
  Type: TrueColorAlpha
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
    alpha: 1-bit
  Channel statistics:
    Red:
      min: 0 (0)
      max: 255 (1)
      mean: 23.5516 (0.0923594)
      standard deviation: 45.5054 (0.178452)
      kurtosis: 6.08194
      skewness: 2.57405
    Green:
      min: 0 (0)
      max: 255 (1)
      mean: 27.4598 (0.107685)
      standard deviation: 49.9626 (0.195932)
      kurtosis: 4.86179
      skewness: 2.35287
    Blue:
      min: 0 (0)
      max: 255 (1)
      mean: 30.6903 (0.120354)
      standard deviation: 52.163 (0.204561)
      kurtosis: 4.12348
      skewness: 2.19067
    Alpha:
      min: 255 (1)
      max: 255 (1)
      mean: 255 (1)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 20.4254 (0.0800997)
      standard deviation: 42.6848 (0.167392)
      kurtosis: 9.61421
      skewness: 3.20092
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.73469,0.2653)
    green primary: (0.1596,0.84039)
    blue primary: (0.0366,0.0001)
    white point: (0.3457,0.35853)
  Interlace: None
  Background color: white
  Border color: srgba(223,223,223,1)
  Matte color: grey74
  Transparent color: none
  Compose: Over
  Page geometry: 1920x685+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    date:create: 2017-10-20T14:28:24+03:00
    date:modify: 2017-10-20T14:28:24+03:00
    png:cHRM                 : chunk was found (see Chromaticity, above)
    png:gAMA                 : gamma=0.45454544 (See Gamma, above)
    png:iCCP                 : chunk was found
    png:IHDR.bit_depth       : 8
    png:IHDR.color_type      : 6 (RGBA)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height    : 1920, 685
    png:pHYs                 : x_res=2835, y_res=2835, units=1
    png:sRGB                 : intent=0 (See Rendering intent)
    signature: 1a57cdbc5ff9b4f7cf2978fc428bb1a4c8476311eda2c9368e909a4e2efbcb8f
  Profiles:
    Profile-icc: 940 bytes
      Description: ProPhoto RGB
      Manufacturer: KODAK
      Model: Reference Output Medium Metric(ROMM)
      Copyright: Copyright (c) Eastman Kodak Company, 1999, all rights reserved.
  Artifacts:
    filename: test.png
    verbose: true
  Tainted: True
  Filesize: 1.294MB
  Number pixels: 1.315M
  Pixels per second: 13.15MB
  User time: 0.070u
  Elapsed time: 0:01.100
  Version: ImageMagick 6.7.7-10 2017-07-31 Q16 http://www.imagemagick.org
So now I do that convert test.png -profile "test.icc" test2.png nothing prints (no errors or anything), test2.png is created and here is the info:

Code: Select all

Image: test2.png
  Format: PNG (Portable Network Graphics)
  Class: DirectClass
  Geometry: 1920x685+0+0
  Resolution: 28.35x28.35
  Print size: 67.7249x24.1623
  Units: PixelsPerCentimeter
  Type: TrueColorAlpha
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
    alpha: 1-bit
  Channel statistics:
    Red:
      min: 0 (0)
      max: 255 (1)
      mean: 15.986 (0.0626904)
      standard deviation: 44.9361 (0.17622)
      kurtosis: 7.56674
      skewness: 2.91766
    Green:
      min: 0 (0)
      max: 255 (1)
      mean: 26.7114 (0.104751)
      standard deviation: 56.5643 (0.221821)
      kurtosis: 3.71287
      skewness: 2.18463
    Blue:
      min: 0 (0)
      max: 255 (1)
      mean: 29.9582 (0.117483)
      standard deviation: 58.4344 (0.229154)
      kurtosis: 3.02729
      skewness: 2.01204
    Alpha:
      min: 255 (1)
      max: 255 (1)
      mean: 255 (1)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 18.1639 (0.071231)
      standard deviation: 46.4579 (0.182188)
      kurtosis: 8.62801
      skewness: 3.1103
  Rendering intent: Perceptual
  Gamma: 0.45455
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Interlace: None
  Background color: white
  Border color: srgba(223,223,223,1)
  Matte color: grey74
  Transparent color: none
  Compose: Over
  Page geometry: 1920x685+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    date:create: 2017-10-25T12:00:05+03:00
    date:modify: 2017-10-25T12:00:05+03:00
    png:bKGD                 : chunk was found (see Background color, above)
    png:cHRM                 : chunk was found (see Chromaticity, above)
    png:gAMA                 : gamma=0.45454544 (See Gamma, above)
    png:IHDR.bit_depth       : 8
    png:IHDR.color_type      : 6 (RGBA)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height    : 1920, 685
    png:pHYs                 : x_res=2835, y_res=2835, units=1
    png:sRGB                 : intent=0 (See Rendering intent)
    png:text                 : 2 tEXt/zTXt/iTXt chunks were found
    signature: a436dc0799478c1dfa7c8c8df131b69545045a07d4d3c2c423af044fef49c009
  Artifacts:
    filename: test2.png
    verbose: true
  Tainted: True
  Filesize: 990KB
  Number pixels: 1.315M
  Pixels per second: 43.84MB
  User time: 0.020u
  Elapsed time: 0:01.029
  Version: ImageMagick 6.7.7-10 2017-07-31 Q16 http://www.imagemagick.org
Initially I thought it might have something to do with that PHP extension (I'm using \Imagick() in a php script to resize some images) but then I did this test - directly trying to convert an image. As you see above - no matter what I do, the resulted image always ends up having no profile at all... :/

Re: Always ignores icc profile :(

Posted: 2017-10-25T04:01:07-07:00
by vladimir.mavrodiev
Actually I just took a look at the test2.png image and now I'm even more confused... :)
So the problem was that when that image (test.png) went through this resizing php script it kinda lost a lot of its colors... I researched around for similar issues and got to the idea that the reason for that was not keeping its correct color profile (this ProPhoto). But just now I saw that the test2.png that I converted from the command line (although not having a profile) kept its colors. So I might be right afterall and this Imagick php extension might have something to do with the issue...

I've uploaded the images for you to check as well:
test.png - the original image
test2.png - converted with command line
test_imagick.png - converted with Imagick PHP extension

also they seem to loose a bit of brightness?

Re: Always ignores icc profile :(

Posted: 2017-10-25T04:26:51-07:00
by snibgo
With a fairly recent version (v6.9.5-3), this...

Code: Select all

convert -verbose c:pictures\test.png -profile sRGB.icc d.png
... works fine, embedding the sRGB profile, and changing the image only very slightly (which is probably a gamut problem), far less than your command changes it.

Fred has tested under 6.7.7.10, and that works. So I suspect you have a bad build of IM. Ubuntu users have reported that the "current" version of IM on Ubuntu has an old version number, but has had some recent patches applied, and not others. That is bad news for any software. If an inconsistent set of patches is applied we can't expect it to work properly.