color names

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
richardsun

color names

Post by richardsun »

I'm working with Anthony's examples. When I run the code below, I get the error below:

$ convert -size 120x120 plasma:fractile fractal.png
convert: unrecognized color `fractile'.
convert: missing an image filename `fractal.png'.

I have run this on UNIX with 2.6.8 and 2.6.9. A Google search shows that the command was published at least since 2.6.6.

When I substitute other colors (such as black, blue or skyblue) for fractile, the command succeeds. Therefore I would assume that fractile is just a placeholder for a valid color. Is this correct?

This led me to search the source for color names and I was unable to find them. How can I get the list of color constants that ImageMagick recognizes?

Thanks,
Jeff
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: color names

Post by el_supremo »

The list of names is in colors.xml where you will find that "fractal" is defined as rgb(128,128,128).

[edit] I've had a quick look at the source and the colour specified after plasma: (e.g. plasma:fractal) is used to initialize the image and then the plasma routine modifies it from there.

Pete
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: color names

Post by Bonzo »

Upload and run this code; it may ask you to download a page or may display the info in the browser.

Code: Select all

<?php
header('Content-Type: text/plain'); 
system("exec 2>&1; convert -list color");
?>
richardsun

Re: color names

Post by richardsun »

Thanks,

I grepped the source without ignoring case, so I missed colors.xml.

Running

Code: Select all

convert -list color
at the command prompt works great.

I guess there's a typo in the original example: "fractile" should be "fractal".

-- Jeff
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: color names

Post by anthony »

just a couple of points.

First 'fractile' was a spelling mistake as was just corrected.

Next while 'fractal' is a listed color, plasma: does not use it as a color. If it did you would have to use plasma:fractal-fractal which is close to using to plasma:Grey-Grey.

This very simular to but is not that same as what you get with plasma:fractal, which uses a higher contrast in the result.

Finally, you can not just pick colors from the color list or even the "colors.xml" file, as any SVG definition will override equivelent naming from X11, and BOTH colors are listed!

As such Green is a half-bright green, while Lime is true RGB green. Simularly for Purple, Gray, and Maroon.

Also note that for X11 Gray and Gray are the same color, but due to the SVG color definations they are different colors in ImageMagick.
That is Gray is very close to Silver or light grey color.
On the other hand Grey is very close to a proper mid-tone grey (gray50 or posibily fractal ;-) ).

If you like to know what color is actually picked by IM use

Code: Select all

  convert xc:gray -depth 8 txt:-
Or if you have a recent IM you can also use...

Code: Select all

  convert xc:gray -format 'rgb(%[fx:r*255%256],%[fx:g*255%256],%[fx:b*255%256])' info:-

NOTE: None of the above has been added to IM examples, but will be added to 'basics' at some point
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply