Why my ImageMagick performs colortoning with different resul

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
honzajavorek
Posts: 3
Joined: 2013-03-14T03:10:33-07:00
Authentication code: 6789

Why my ImageMagick performs colortoning with different resul

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Why my ImageMagick performs colortoning with different r

Post 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).
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Why my ImageMagick performs colortoning with different r

Post by fmw42 »

honzajavorek
Posts: 3
Joined: 2013-03-14T03:10:33-07:00
Authentication code: 6789

Re: Why my ImageMagick performs colortoning with different r

Post 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.
honzajavorek
Posts: 3
Joined: 2013-03-14T03:10:33-07:00
Authentication code: 6789

Re: Why my ImageMagick performs colortoning with different r

Post 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).
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Why my ImageMagick performs colortoning with different r

Post 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.
Post Reply