ICC profiles are precise descriptions of the colours that output devices should show from pixel values.
There are three purposes for profiles:
An image might contain any number of profiles for these purposes. However, ImageMagick isn't concerned with input and output devices. IM uses profiles only to describe the working colourspace.
%IM%convert ^ -background Lime ^ -size 200x100 -fill Red label:" red " ^ -size 200x100 -fill Blue label:"blue" ^ -gravity Center ^ -append ^ pr_rb0.png |
|
%IM%convert ^ pr_rb0.png ^ -profile sRGB.icc ^ pr_rb1.png |
|
%IM%convert ^ pr_rb1.png ^ -profile snibgoGBR.icc ^ pr_rb2.png This is wrong. |
|
%IM%convert ^ pr_rb0.png ^ -profile sRGB.icc ^ -profile snibgoGBR.icc ^ pr_rb2a.png |
|
%IM%convert ^ pr_rb1.png ^ -profile sRGB.icc ^ -profile snibgoGBR.icc ^ pr_rb2aa.png |
|
%IM%convert ^ pr_rb2.png ^ -quiet -strip ^ pr_rb3.png cmd /c exit /B 0 |
|
%IM%convert ^ pr_rb2a.png ^ -quiet -strip ^ pr_rb3a.png cmd /c exit /B 0 |
|
%IM%convert ^ pr_rb2a.png ^ -profile sRGB.icc ^ pr_rb2as.png cmd /c exit /B 0 |
The profile snibgoGBR.icc approximately rotates the three colour channels. This is approximate, not exact.
Gamut: Show a triangle of colours, containing smaller triangle smaller gamut. A gamut is really a volume (because we usually regard collours as having three dimensions.) If the wide gamut has to be reduced, how do we do it? The difference is (mostly) in saturation. Out of gamut means outside a particular gamut -- the gamut of sRGB or AdobeRGB1998, or the gamut of the monitor or printer.
http://www.youtube.com/watch?v=n0bxSD-Xx-Q Everything you thought you wanted to know about color gamut Andrew Rodney ColorThink Pro Can IM show which pixels would be out of gamut? Yes. outGamut.bat: rem Make a mask that is white where pixels are outside sRGB gamut, rem black otherwise. %IM%convert ^ hald:8 ^ -set profile AdobeRGB1998.icc ^ -profile D65_XYZ.icc +strip -set colorspace XYZ -colorspace sRGB ^ ( +clone ^ -clamp ^ ) ^ -compose Difference -composite ^ -fill #fff +opaque #000 ^ h.pngrem From image %1, makes 9-panel with varying threshold. rem %2 is first number. rem %3 is increment. @if "%1"=="" findstr /B "rem @rem" %~f0 & exit /B 1 @setlocal enabledelayedexpansion @call echoOffSave @call %PICTBAT%setInOut %1 th9 @set BASE=%2 @if "%BASE%"=="" set BASE=10 @set DIFF=%3 @if "%DIFF%"=="" set DIFF=10 @set /A f0=%BASE% @set /A f1=%BASE%+%DIFF% @set /A f2=%BASE%+(%DIFF%*2) @set /A f3=%BASE%+(%DIFF%*3) @set /A f4=%BASE%+(%DIFF%*4) @set /A f5=%BASE%+(%DIFF%*5) @set /A f6=%BASE%+(%DIFF%*6) @set /A f7=%BASE%+(%DIFF%*7) @set /A f8=%BASE%+(%DIFF%*8) @set OPTIONS=+dither "%IMG%convert" %INFILE% -resize "300x300^>" ^ +dither ^ ( -clone 0 ^ ( -clone 0 %OPTIONS% -threshold %f0%%% -gravity center label:"-threshold %f0%%%" -append ) ^ ( -clone 0 %OPTIONS% -threshold %f1%%% -gravity center label:"-threshold %f1%%%" -append ) ^ ( -clone 0 %OPTIONS% -threshold %f2%%% -gravity center label:"-threshold %f2%%%" -append ) ^ -delete 0 ^ +append ^ ) ^ ( -clone 0 ^ ( -clone 0 %OPTIONS% -threshold %f3%%% -gravity center label:"-threshold %f3%%%" -append ) ^ ( -clone 0 %OPTIONS% -threshold %f4%%% -gravity center label:"-threshold %f4%%%" -append ) ^ ( -clone 0 %OPTIONS% -threshold %f5%%% -gravity center label:"-threshold %f5%%%" -append ) ^ -delete 0 ^ +append ^ ) ^ ( -clone 0 ^ ( -clone 0 %OPTIONS% -threshold %f6%%% -gravity center label:"-threshold %f6%%%" -append ) ^ ( -clone 0 %OPTIONS% -threshold %f7%%% -gravity center label:"-threshold %f7%%%" -append ) ^ ( -clone 0 %OPTIONS% -threshold %f8%%% -gravity center label:"-threshold %f8%%%" -append ) ^ -delete 0 ^ +append ^ ) ^ -delete 0 ^ -append ^ %OUTFILE% call echoRestore @endlocal
All images on this page were created by the commands shown, using:
%IM%identify -version
Version: ImageMagick 6.9.0-0 Q16 x64 2014-11-14 http://www.imagemaeration: 3,1,65535,srgb 0,0: (79.2584%,14.8455%,15.1629%) #CAE6260126D1 srgb(79.2584%,14.8455%,15.1629%) 1,0: (0%,62.2309%,9.71389%) #00009F4F18DE srgb(0%,62.2309%,9.71389%) 2,0: (12.7855%,16.7254%,70.9895%) #20BB2AD1B5BB srgb(12.7855%,16.7254%,70.9895%)
%IM%convert ^ pr_rb2a.png ^ -intent Perceptual ^ -profile sRGB.icc ^ +write pr_rb2as_ip.png ^ -unique-colors txt: cmd /c exit /B 0
# ImageMagick pixel enumeration: 3,1,65535,srgb 0,0: (79.9405%,20.8042%,21.0925%) #CCA5354235FF srgb(79.9405%,20.8042%,21.0925%) 1,0: (24.509%,69.6025%,20.4196%) #3EBEB22E3446 srgb(24.509%,69.6025%,20.4196%) 2,0: (21.1063%,21.2604%,79.1852%) #3608366DCAB6 srgb(21.1063%,21.2604%,79.1852%)
%IM%convert ^ pr_rb2a.png ^ -intent Relative ^ -profile sRGB.icc ^ +write pr_rb2as_ir.png ^ -unique-colors txt: cmd /c exit /B 0
# ImageMagick pixel enumeration: 3,1,65535,srgb 0,0: (79.2584%,14.8455%,15.1629%) #CAE6260126D1 srgb(79.2584%,14.8455%,15.1629%) 1,0: (0%,62.2309%,9.71389%) #00009F4F18DE srgb(0%,62.2309%,9.71389%) 2,0: (12.7855%,16.7254%,70.9895%) #20BB2AD1B5BB srgb(12.7855%,16.7254%,70.9895%)
%IM%convert ^ pr_rb2a.png ^ -intent Saturation ^ -profile sRGB.icc ^ +write pr_rb2as_is.png ^ -unique-colors txt: cmd /c exit /B 0
# ImageMagick pixel enumeration: 3,1,65535,srgb 0,0: (79.9405%,20.8042%,21.0925%) #CCA5354235FF srgb(79.9405%,20.8042%,21.0925%) 1,0: (24.509%,69.6025%,20.4196%) #3EBEB22E3446 srgb(24.509%,69.6025%,20.4196%) 2,0: (21.1063%,21.2604%,79.1852%) #3608366DCAB6 srgb(21.1063%,21.2604%,79.1852%)
The profile snibgoGBR.icc approximately rotates the three colour channels. This is approximate, not exact.
We can convert between sRGB and CMYK colorspaces, without using profiles. This might be because some processing is more conveniently done in CMYK space.
CMYK can't be stored in PNG files. It can be stored in TIFF or JPG. Here, I use TIFF when I want to do further processing, and JPG for web display purposes only.
Convert sRGB to CMYK. %IM%convert ^ pr_rb0.png ^ -colorspace CMYK ^ +write pr_scmyk0.tiff ^ +write pr_scmyk0.jpg ^ -unique-colors txt: # ImageMagick pixel enumeration: 3,1,65535,cmyk 0,0: (74.9996%,74.9996%,0%,20%) #BFFFBFFF00003333 cmyk(74.9996%,74.9996%,0%,20%) 1,0: (71.429%,0%,71.429%,29.9992%) #B6DB0000B6DB4CCC cmyk(71.429%,0%,71.429%,29.9992%) 2,0: (0%,74.9996%,74.9996%,20%) #0000BFFFBFFF3333 cmyk(0%,74.9996%,74.9996%,20%) |
|
Convert CMYK to sRGB. %IM%convert ^ pr_scmyk0.tiff ^ -colorspace sRGB ^ +write pr_scmyk0_rgb.png ^ -unique-colors txt: # ImageMagick pixel enumeration: 3,1,65535,srgb 0,0: (80%,20%,20%) #CCCC33333333 srgb(204,51,51) 1,0: (20%,70.0008%,20%) #3333B3333333 srgb(20%,70.0008%,20%) 2,0: (20%,20%,80%) #33333333CCCC srgb(51,51,204) |
The processing is exact, and there is no data loss. With IM, the gamuts of sRGB and CMYK coincide exactly.
CMYK is most often used because this is the natural colorspace of printers. A printer works by depositing layers of ink, and each layer darkens the image: colours are made by subtraction. (A computer monitor works by adding light, so each layer lightens the image: colours are made by addition.)
The gamuts of monitors and printers are generally different; each can create colours that the other can't.
PNG can't store CMYK. I record results losslessly in TIFF for further processing, and also write a JPG for web display purposes only.
%IM%convert ^ pr_rb0.png ^ -profile sRGB.icc ^ -profile USWebCoatedSWOP.icc ^ +write pr_cmyk0.tiff ^ +write pr_cmyk0.jpg ^ -unique-colors txt: # ImageMagick pixel enumeration: 3,1,65535,cmyk 0,0: (93.5958%,90.0847%,0%,0%) #EF9AE69D00000000 cmyk(93.5958%,90.0847%,0%,0%) 1,0: (84.9058%,13.5409%,100%,2.56657%) #D95B22AAFFFF0692 cmyk(84.9058%,13.5409%,100%,2.56657%) 2,0: (17.2412%,93.55%,88.04%,6.61936%) #2C23EF7CE16110F2 cmyk(17.2412%,93.55%,88.04%,6.61936%) Possible IM bug: -unique-colors ignores K values. |
|
%IM%convert ^ pr_cmyk0.tiff ^ -profile sRGB.icc ^ +write pr_cmyk0_srgb.tiff ^ +write pr_cmyk0_srgb.jpg ^ -unique-colors txt: # ImageMagick pixel enumeration: 3,1,65535,srgb 0,0: (76.0479%,21.2696%,21.1215%) #C2AE36733612 srgb(76.0479%,21.2696%,21.1215%) 1,0: (24.7181%,65.8717%,31.5526%) #3F47A8A150C6 srgb(24.7181%,65.8717%,31.5526%) 2,0: (23.6286%,25.9831%,61.9623%) #3C7D42849E9F srgb(23.6286%,25.9831%,61.9623%) |
Gamut: Show a triangle of colours, containing smaller triangle smaller gamut. A gamut is really a volume (because we usually regard colours as having three dimensions.) If the wide gamut has to be reduced, how do we do it? The difference is (mostly) in saturation. Out of gamut means outside a particular gamut -- the gamut of sRGB or AdobeRGB1998, or the gamut of the monitor or printer.
http://www.youtube.com/watch?v=n0bxSD-Xx-Q Everything you thought you wanted to know about color gamut Andrew Rodney ColorThink ProCan IM show which pixels would be out of gamut? Yes, using HDRI ImageMagick. outGamut.bat:
rem Make a mask that is white where pixels are outside sRGB gamut, rem black otherwise. %IMDEV%convert ^ hald:8 ^ -set profile AdobeRGB1998.icc ^ -profile D65_XYZ.icc +strip -set colorspace XYZ -colorspace sRGB ^ ( +clone ^ -clamp ^ ) ^ -compose Difference -composite ^ -fill #fff +opaque #000 ^ h.png
rem From image %1, makes 9-panel with varying threshold. rem %2 is first number. rem %3 is increment. @if "%1"=="" findstr /B "rem @rem" %~f0 & exit /B 1 @setlocal enabledelayedexpansion @call echoOffSave @call %PICTBAT%setInOut %1 th9 @set BASE=%2 @if "%BASE%"=="" set BASE=10 @set DIFF=%3 @if "%DIFF%"=="" set DIFF=10 @set /A f0=%BASE% @set /A f1=%BASE%+%DIFF% @set /A f2=%BASE%+(%DIFF%*2) @set /A f3=%BASE%+(%DIFF%*3) @set /A f4=%BASE%+(%DIFF%*4) @set /A f5=%BASE%+(%DIFF%*5) @set /A f6=%BASE%+(%DIFF%*6) @set /A f7=%BASE%+(%DIFF%*7) @set /A f8=%BASE%+(%DIFF%*8) @set OPTIONS=+dither "%IM%convert" %INFILE% -resize "300x300^>" ^ +dither ^ ( -clone 0 ^ ( -clone 0 %OPTIONS% -threshold %f0%%% -gravity center label:"-threshold %f0%%%" -append ) ^ ( -clone 0 %OPTIONS% -threshold %f1%%% -gravity center label:"-threshold %f1%%%" -append ) ^ ( -clone 0 %OPTIONS% -threshold %f2%%% -gravity center label:"-threshold %f2%%%" -append ) ^ -delete 0 ^ +append ^ ) ^ ( -clone 0 ^ ( -clone 0 %OPTIONS% -threshold %f3%%% -gravity center label:"-threshold %f3%%%" -append ) ^ ( -clone 0 %OPTIONS% -threshold %f4%%% -gravity center label:"-threshold %f4%%%" -append ) ^ ( -clone 0 %OPTIONS% -threshold %f5%%% -gravity center label:"-threshold %f5%%%" -append ) ^ -delete 0 ^ +append ^ ) ^ ( -clone 0 ^ ( -clone 0 %OPTIONS% -threshold %f6%%% -gravity center label:"-threshold %f6%%%" -append ) ^ ( -clone 0 %OPTIONS% -threshold %f7%%% -gravity center label:"-threshold %f7%%%" -append ) ^ ( -clone 0 %OPTIONS% -threshold %f8%%% -gravity center label:"-threshold %f8%%%" -append ) ^ -delete 0 ^ +append ^ ) ^ -delete 0 ^ -append ^ %OUTFILE% call echoRestore @endlocal
All images on this page were created by the commands shown, using:
%IM%identify -version
Version: ImageMagick 6.9.0-10 Q16 x64 2015-02-28 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: DPC OpenMP Delegates (built-in): bzlib cairo freetype jbig jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
To improve internet download speeds, some images may have been automatically converted (by ImageMagick, of course) from PNG to JPG.
Source file for this web page is profile is profiles.h1. To re-create this web page, run "procH1 profiles".
This page, including the images, is my copyright. Anyone is permitted to use or adapt any of the code, scripts or images for any purpose, including commercial use.
Anyone is permitted to re-publish this page, but only for non-commercial use.
Anyone is permitted to link to this page, including for commercial use.
Page version v1.0 11-March-2015.
Page created 13-Oct-2015 23:02:01.
Copyright © 2015 Alan Gibson.