Page 1 of 1

Why my ImageMagick performs colortoning with different resul

Posted: 2013-03-14T03:20:35-07:00
by honzajavorek
I found Instagraph PHP library (GitHub, NetTuts) for photo filters. However, I found out on my box it does not output the same images as presented on NetTuts.

I localized the issue and it has to be within colortone function, because otherwise filters work well. Let's take Toaster as a showcase, because it performs only one colortone transformation. Code generated by the colortone PHP function (bash-escaped):

Code: Select all

convert test.jpg \( -clone 0 -fill '#330000' -colorize 100% \) \( -clone 0 -colorspace gray -negate \) -compose blend -define compose:args=100,0 -composite test.jpg
The rest of sequence of command to complete the filter (those should be all right):

Code: Select all

convert test.jpg -modulate 150,80,100 -gamma 1.2 -contrast -contrast test.jpg
convert test.jpg \( -size 960.0x960.0 radial-gradient:none-LavenderBlush3 -gravity center -crop 640x640+0+0 +repage \) -compose multiply -flatten test.jpg
convert test.jpg \( -size 960.0x960.0 radial-gradient:#ff9966-none -gravity center -crop 640x640+0+0 +repage \) -compose multiply -flatten test.jpg
And now, let's look at the expected result of the Toaster filter:

Image

However, my script produces following:

Image

It is a lot darker, but I have no idea why. There are probably only two options to explain such behavior:
  • Author of the library has a bug in his library. (I do not think so, but it is still possible...)
  • My ImageMagick is different than author's and so it produces different results. (How that can happen?)
Has anyone a clue why my ImageMagick produces different results? Could it be some initial settings? My ImageMagick is installed purely from standard Ubuntu package.

Code: Select all

$ convert --version
Version: ImageMagick 6.7.7-10 2012-08-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
Could anyone help me to get the expected output?

I filed similar StackOverflow question and an issue on GitHub.

Re: Why my ImageMagick performs colortoning with different r

Posted: 2013-03-14T04:50:03-07:00
by snibgo
Ubuntu's version of Imagemagick is ancient, and was before the RGB/sRGB issue. I suggest you upgrade to the current version (or at least v6.7.9).

Re: Why my ImageMagick performs colortoning with different r

Posted: 2013-03-14T09:59:44-07:00
by fmw42

Re: Why my ImageMagick performs colortoning with different r

Posted: 2013-03-15T03:13:07-07:00
by honzajavorek
I compiled my own latest upstream version of ImageMagick and it produced the same, wrong output.

Code: Select all

$ convert --version
Version: ImageMagick 6.8.3-9 2013-03-15 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib djvu mpeg fontconfig freetype jbig jng jp2 jpeg lcms lqr lzma openexr png ps tiff x xml zlib
I am going to check out the links from fmw42 and to do further investigation.

Re: Why my ImageMagick performs colortoning with different r

Posted: 2013-03-15T03:34:22-07:00
by honzajavorek
Great! This produces completely the same output as expected:

Code: Select all

convert test.jpg -set colorspace RGB \( -clone 0 -fill '#330000' -colorize 100% \) \( -clone 0 -colorspace gray -negate \) -compose blend -define compose:args=100,0 -composite test.jpg
(mind the added -set colorspace RGB)

Thank you very much, guys! If you know how, you can mark this as solved (I tried to adjust name of the topic, but apparently I can't).

Re: Why my ImageMagick performs colortoning with different r

Posted: 2013-03-15T13:27:45-07:00
by fmw42
You can edit the topic title to add SOLVED to the beginning, but the field is limited in length, so you must delete some from the end.