SparseColor is not working

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
venkat

SparseColor is not working

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: SparseColor is not working

Post 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.
venkat

Re: SparseColor is not working

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: SparseColor is not working

Post by fmw42 »

sorry I don't know anything about Windows or .Net. I am a Mac person.
venkat

Re: SparseColor is not working

Post 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
venkat

Re: SparseColor is not working

Post by venkat »

can anyone tell me how to access SparseColor with .NET wrapper?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: SparseColor is not working

Post by fmw42 »

try posting to the Users or Windows forums at index.php
venkat

Re: SparseColor is not working

Post by venkat »

OK Thank you.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: SparseColor is not working

Post by fmw42 »

My guess is that it probably has not been folded into that API as it is relatively new to command line.
venkat

Re: SparseColor is not working

Post 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 );
Post Reply