This threads explains what I was trying to do:
viewtopic.php?f=1&t=25660
Here I give simple example how the command to select shadows on routes could look:
example 1:
Code: Select all
convert -HSLRangeMin(197, 21, 29) -HSLRangeMax(222, 40, 33) ... // checking one set of colors
or just
convert -HSLRange(197, 21, 29, 222, 40, 33) ... // checking one set of colors
or using multiple options:
convert -HSLRange(197, 21, 29, 222, 40, 33),(104, 8, 31, 216, 33, 46) ... // checking multiple sets of colors
or yet improved with fuzz:
convert -fuzz 4 -HSLRange(197, 21, 29, 222, 40, 33),(104, 8, 31, 216, 33, 46) ... // checking multiple sets of colors. You could have as many sets of colors as you want, but usually 1-3 could be enough
To type it in the programming way ...
Code: Select all
HSL_min1 = { H:197, S:21, L:29}; // meaning: ( color is in range of H>=197 && S>=21 && L >=29
HSL_max1 = { H:222, S:40, L:33}; // and H<=222 && S<=40 && L <=33 ) // dark shadows
// or
HSL_min2 = { H:104, S:8, L:31}; // ( color is in range of H>=104 && S>=8 && L >=31
HSL_max2 = { H:216, S:33, L:46}; // and H<=216 && S<=33 && L <=46 ) // light shadows
// and so on ...
In addition I add here some example of code in PHP how I am used to work with colors in HSL. This is not exactly the same situation, but very similar, the example calculates average color from image and defines colors based on HSL/HSV module:
http://paste.ofcode.org/W8hFyRZmZHzNaJMriQwSWw
(The colors definition is yet more improved there. I can select how many componenst I am interested. I can look for colors based on Hue, Saturation or Lightness ... or combination of two of them.) PHP works differently then IM, but the essence is similar.
E.g. example of lips - create conditions to turn the red colors more dark
Code: Select all
$lessSingle = new less_exceptions('single',53,'s'); // I created exception for colors which means that colors which have saturation <=53 should be excluded from result...
$Interval_teeth = new interval_exceptions( 'three', array('ll'=>array(array(12,12,79)),'ul'=>array(array(13,17,83))) ); // ll - lower limit, ul - upper limit
$exceptionsToken = array($Interval_teeth,$lessSingle); // exceptionsToken keeps my exceptions (these colors wont be included in result - wont be effected
// The following are based on RGB but the core works with HSL/HSV model
// Also the exceptions are defined in HSL model. Just for html I use RGB model in HEX
$myColorsForAvarage = array( 'cc825f', 'f21a1a','9b5042', '933f31', 'ff9393', 'd09e9e');
$nextColorsForReplace = array('d0d0d0', '7a7a7a'); // this will be added to $myColorsForAvarage
// Finally I use this to replace the colors: I pass all color limits and color exceptions
color_math::replaceColors($file,$myColorsForAvarage,$nextColorsForReplace,$exceptionsToken, $replaceColor, true);
// So this is yet advanced example