Pranav Patel
Pranav Patel

Reputation: 154

unrecognized color `00000f' with Convert Command

I am getting the error while trying to run convert command. Here is the command.

convert -colorspace rgb 10338_1.ai -transparent 00000f 10338_1.png

and i am getting the error is

convert: unrecognized color `00000f' @ color.c/GetColorInfo/965.

Any Solution?

Upvotes: 0

Views: 1248

Answers (3)

Mark Setchell
Mark Setchell

Reputation: 207670

We can analyse your image by looking at its histogram, like this:

convert a.ps -format "%c" histogram:info:
608007: (    0,    0,    0,    0) #0000000000000000 cmyk(0,0,0,0)
 58793: (    0,    0,    0,65535) #000000000000FFFF cmyk(0,0,0,255)
  6551: (    0,    0,    0,34952) #0000000000008888 cmyk(0,0,0,136)
  5095: (    0,    0,    0,48059) #000000000000BBBB cmyk(0,0,0,187)
  4350: (    0,    0,    0,17476) #0000000000004444 cmyk(0,0,0,68)
  3297: (    0,    0,    0,61166) #000000000000EEEE cmyk(0,0,0,238)
  2897: (    0,    0,    0, 4369) #0000000000001111 cmyk(0,0,0,17)

First, you notice it is in CMYK colourspace, not RGB. You can see that the predominant colour is black with 608007 pixels, and that all the other colours in the image are actually just shades of black, but all have zero values for the CMY components. That means you lose nothing by just extracting the blacks into a greyscale image like this:

convert a.ps -channel K out.png

enter image description here

Maybe now you can do what you want, for example you can set the white pixels transparent like this:

convert out.png -transparent white result.png

Upvotes: 1

slevy1
slevy1

Reputation: 3820

The previous answer is correct about the hashtag. For more info see http://www.imagemagick.org/script/color.php.

Upvotes: 1

Aleksei Matiushkin
Aleksei Matiushkin

Reputation: 121000

The color should be given in HTML notation with hash in front of it:

convert -colorspace rgb 10338_1.ai -transparent '#00000f' 10338_1.png

Upvotes: 2

Related Questions