Page 1 of 1
SPARSECOLORMETHOD_BARYCENTRIC problem
Posted: 2013-02-06T15:31:44-07:00
by shirkavand
I want to execute the next imageMagick command using IMagick:
Code: Select all
convert girl.jpg -sparse-color barycentric '0,0 black 319,0 white' out.jpg
So, i ended with:
Code: Select all
$firstImage = new imagick( "girl.jpg" );
$firstImage->sparseColorImage(Imagick::SPARSECOLORMETHOD_BARYCENTRIC, array( 0, 0, "black", 319, 0, "white"));
$firstImage->writeImage("./out.jpg");
but nothing happens, the out.jpg images is just like the original. Any idea?
Re: SPARSECOLORMETHOD_BARYCENTRIC problem
Posted: 2013-02-06T16:00:06-07:00
by fmw42
I suspect that Imagick has not been upgraded to include that an many other IM changes since the last version of Imagick was released.
Re: SPARSECOLORMETHOD_BARYCENTRIC problem
Posted: 2013-04-28T05:35:17-07:00
by anthony
The API's do not use the routine I use to parse a single string with colornames to a array of numbers (with the right counts accoding to the image and channel setting).
Originally the routine that does this was in the 'core' library so that it would be available for parsing a 'single string argument' but this was then moved into the command parser and made static to that module only. This was not my doing, and I has misgivings about that specific move.
As a consequence you have to specify each of the color as purely an array of numbers, without the colorname conversion
what numbers (floating point) are needed for each color depends on the intersection of the 'channel' setting and the channels present in the image. Whcih as you can immagine can be a little tricky to handle.
It is posible the API you are using could be set up to handle an array such as you have specified, but currently that is not the case.