Page 1 of 1

SparseColor is not working

Posted: 2009-12-16T03:16:07-07:00
by venkat
Hi all,

I have some problem with SparseColor().
I had download latest version and i took libraries and includes and builded project in VC++ to get .NET dll.
All methods are working fine and i am able to access all methods, but SparseColor is giving exception when i called.

"Sparse color image, given a set of coordinates, interpolates the colors found at those coordinates, across the whole image, using various methods."
Syntax:
SparseColor (ChannelType channel_, SparseColorMethod method_, unsigned long number_arguments, double *arguments_ );

Example:
ImageMagickNET.Image imageMagick = new ImageMagickNET.Image( "C:\\img1.jpg" );
double dArguments=10;
double *pArguments=&dArguments;
imageMagick.SparseColor(ChannelType.BlueChannel,SparseColorMethod.BarycentricColorInterpolate,(uint)1, pArguments );

The above example is giving exception like "External component has thrown an exception."

Can you tell me how to solve this problem.

Even it is not working in command prompt also

My code::
C:\Program Files\ImageMagick-6.5.8-Q16> convert -size 100x100 xc: -sparse-color Bilinear '30,10 red 10,80 blue 70,60 lime 80,20 yellow' -fill white -stroke black -draw 'circle 30,10 30,12 circle 10,80 10,82' -draw 'circle 70,60 70,62 circle 80,20 80,22' C:\sam\sas.jpg

I am getting Errors like::
convert: invalid argument for option `sparse-color': Invalid number of Arguments
@ mogrify.c/SparseColorOption/456.
convert: unable to open image `red': No such file or directory @ blob.c/OpenBlob/2480.
convert: unable to open image `10,80': No such file or directory @ blob.c/OpenBlob/2480.
convert: unable to open image `blue': No such file or directory @ blob.c/OpenBlob/2480.
convert: unable to open image `70,60': No such file or directory @ blob.c/OpenBlob/2480.
convert: unable to open image `lime': No such file or directory @ blob.c/OpenBlob/2480.
convert: unable to open image `80,20': No such file or directory @ blob.c/OpenBlob/2480.
convert: unable to open image `yellow'': No such file or directory @ blob.c/OpenBlob/2480.
convert: Non-conforming drawing primitive definition `circle' @ draw.c/DrawImage/3140.
convert: unable to open image `30,10': No such file or directory @ blob.c/OpenBlob/2480.
convert: unable to open image `30,12': No such file or directory @ blob.c/OpenBlob/2480.
convert: unable to open image `circle': No such file or directory @ blob.c/OpenBlob/2480.
convert: unable to open image `10,80': No such file or directory @ blob.c/OpenBlob/2480.
convert: unable to open image `10,82'': No such file or directory @ blob.c/OpenBlob/2480.
convert: Non-conforming drawing primitive definition `circle' @ draw.c/DrawImage/3140.
convert: unable to open image `70,60': No such file or directory @ blob.c/OpenBlob/2480.
convert: unable to open image `70,62': No such file or directory @ blob.c/OpenBlob/2480.
convert: unable to open image `circle': No such file or directory @ blob.c/OpenBlob/2480.
convert: unable to open image `80,20': No such file or directory @ blob.c/OpenBlob/2480.
convert: unable to open image `80,22'': No such file or directory @ blob.c/OpenBlob/2480.
convert: Non-conforming drawing primitive definition `circle' @ draw.c/DrawImage/3140.

please help me.

Thanks
venkat

Re: SparseColor is not working

Posted: 2009-12-16T11:34:55-07:00
by fmw42
This works for me on IM 6.5.8-6 Q16 Mac OSX Tiger.

convert -size 100x100 xc: -sparse-color Bilinear \
'30,10 red 10,80 blue 70,60 lime 80,20 yellow' \
-fill white -stroke black -draw 'circle 30,10 30,12 circle 10,80 10,82' \
-draw 'circle 70,60 70,62 circle 80,20 80,22' \
tmp1.png


Note Bilinear requires 4 points or it reverts to Barycentric. See http://www.imagemagick.org/script/comma ... arse-color

I don't see anything wrong, unless your IM install is bad. Try using double quotes rather than single quotes on windows. See http://www.imagemagick.org/Usage/windows/ for numerous differences with Unix and Windows syntax.

Re: SparseColor is not working

Posted: 2009-12-20T22:02:40-07:00
by venkat
Hi

Thanks for replay and thank you for given suggestion.
I changed single quotes to double quotes in windows, it is working for me also.
but i want to work with .net dll.
can help me to work with .Net dll?

Thanks

Re: SparseColor is not working

Posted: 2009-12-20T23:05:25-07:00
by fmw42
sorry I don't know anything about Windows or .Net. I am a Mac person.

Re: SparseColor is not working

Posted: 2009-12-20T23:46:40-07:00
by venkat
fmw42 wrote:sorry I don't know anything about Windows or .Net. I am a Mac person.
Thank you very much for your co-operation

Re: SparseColor is not working

Posted: 2009-12-21T07:05:39-07:00
by venkat
can anyone tell me how to access SparseColor with .NET wrapper?

Re: SparseColor is not working

Posted: 2009-12-21T10:27:32-07:00
by fmw42
try posting to the Users or Windows forums at index.php

Re: SparseColor is not working

Posted: 2009-12-21T22:01:39-07:00
by venkat
OK Thank you.

Re: SparseColor is not working

Posted: 2009-12-21T22:13:46-07:00
by fmw42
My guess is that it probably has not been folded into that API as it is relatively new to command line.

Re: SparseColor is not working

Posted: 2009-12-21T22:22:20-07:00
by venkat
fmw42 wrote:My guess is that it probably has not been folded into that API as it is relatively new to command line.
No it is folded into API.
I took latest version and i created C++ method to access SparseColor what ever params are specified in "Image.h".

// Sparse color image, given a set of coordinates, interpolates the colors
// found at those coordinates, across the whole image, using various
// methods.
void sparseColor ( const ChannelType channel,
const SparseColorMethod method,
const unsigned long number_arguments,
const double *arguments );