Page 1 of 1

don't grok -fx

Posted: 2016-09-30T07:55:29-07:00
by mikmach
Hello,

I'd like to reduce red tint in areas where red color isn't visually dominant. I've got and idea to play with something like:

abs(b-g) > 0.1 && r-max(b,g) < 0.1 ? r*0.9

Two questions:

- how to implement it with -fx ; for now it responds
convert.exe: unable to parse expression `r' @ error/fx.c/FxEvaluateSubexpression/2307.

- any other idea how to solve that problem?

$ convert -version
Version: ImageMagick 6.9.3-5 Q8 x64 2016-02-20 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib

Re: don't grok -fx

Posted: 2016-09-30T08:37:50-07:00
by snibgo
The "?" operator is ternary: it needs three expressions. You are missing a colon and the third expression, eg:

Code: Select all

abs(b-g) > 0.1 && r-max(b,g) < 0.1 ? r*0.9 : r
When the first expression is true, the result is r*0.9. When it is false, the result is r. (Of course, put whatever you need for the third expression.)

Re: [SOLVED] don't grok -fx + reduce red tint in non red areas

Posted: 2016-10-03T02:00:05-07:00
by mikmach
Thank you very much. I've improved my command. Pure RGB path was nonsense, solution which works perfectly for me:

Code: Select all

convert file.tif -channel H -fx "hue < 0.93 && hue > 0.07 && saturation > 0.15 ? r * 0.98 : r" +channel file-fx.tif