Page 1 of 1

Something has changed around IM 6.7.2-10. Help please!

Posted: 2012-11-23T02:22:13-07:00
by jaz99
Hello, I'm new here and I hope I can get some help.
I'm using ImageMagick on regular basis in my scanning workflow to automate turning the C-41 negative with orange mask (in linear TIFF file) into the positive image.
I'm very happy with it, however the script stopped working with newest IM versions (latest working version reported by other is 6.7.2-10).

The core part of my script is:

Code: Select all

convert "input.tif[0]" -colorspace RGB \
    -channel R -fx "$1/u" \
    -channel G -fx "$2/u" \
    -channel B -fx "$3/u"  -channel RGB out.tif
The full script and test image are available here.

With the newest IM versions the generated colors are way off.

I've spent a lot of time searching for solution (including some -colorspace sRGB and -set colorspace sRGB|RGB experiments), however I've failed.
Does anybody know what has changed in the IM? I'm run out of ideas.

Regards, JaZ

P.S. Is it possible to speed up the -fx "1/u" operation?

Re: Something has changed around IM 6.7.2-10. Help please!

Posted: 2012-11-23T11:35:36-07:00
by fmw42
can you give me test values for the original file test.tif for $1, $2, and $3 so I can test them.

Just using 0.1, the following two are equivalent. Not sure if that is what you want.


convert 1test.tif -set colorspace RGB \
-channel R -fx ".1/u" \
-channel G -fx ".1/u" \
-channel B -fx ".1/u" +channel 1tmp.tif


convert 1test.tif -set colorspace RGB -separate \
\( -clone 0 -fill "gray(10%)" -colorize 100% \) \
\( -clone 3 -clone 0 +swap -compose divide -composite \) \
\( -clone 3 -clone 1 +swap -compose divide -composite \) \
\( -clone 3 -clone 2 +swap -compose divide -composite \) \
-delete 0-3 -combine 1tmp2.tif

Re: Something has changed around IM 6.7.2-10. Help please!

Posted: 2012-11-23T14:38:01-07:00
by jaz99
I can't believe I havn't seen it before. There is a very vicious bug in IM.
In old Imagemagick versions the expression below is working OK, in spite the fact the is one extra parenthesis:

Code: Select all

.... %%[fx: log(maxima.b/minima.b)/log(maxima.r/minima.r))] ...
In newer versions the expression is yelding incorrect outcome without complaining about it.
I have corrected it and the script is working again!

Thanks for helping ;)

The second question remaining: is any way to process it faster?

Re: Something has changed around IM 6.7.2-10. Help please!

Posted: 2012-11-23T14:57:30-07:00
by fmw42
As I mentioned in my second example above

convert 1test.tif -set colorspace RGB -separate \
\( -clone 0 -fill "gray(10%)" -colorize 100% \) \
\( -clone 3 -clone 0 +swap -compose divide -composite \) \
\( -clone 3 -clone 1 +swap -compose divide -composite \) \
\( -clone 3 -clone 2 +swap -compose divide -composite \) \
-delete 0-3 -combine 1tmp2.tif

use -compose divide for each 1/u. In the above I used .1/u so that is 10% gray divided by the image