Page 1 of 1

Posted: 2006-11-12T20:14:17-07:00
by anthony
Well -scale 100% is a no-op. that is it doesn nothing!

As for your problem. I currently know of no way to remove the colors specified by an image from another image. It is not a common thing to do.

You can however re-map specific colors Eg:

Code: Select all

   convert input.png  -transparency green  output.png
will remove all perfect green colors from the image.
For imperfect or 'near' matchs you can add a 'fuzz factor'. See IM examples...
http://www.cit.gu.edu.au/~anthony/graph ... olor/#fuzz

However you can generate a command to do this type of thing! the 'txt:' image format will list the colors in the map into a format that IM can handle.

Code: Select all

  convert colormap.png -unique-colors txt:-
From this you can pull out a column or IM parsable colors, append a "-transparent" to the front of each color and add the result to a command line to convert those colors to transparency.

Code: Select all

convert colormap.png -unique-colors txt:- | \
   sed '1d; s/.*#/#/; s/ .*//; s/^/-transparent /' > remove_colors_args
   convert input.png  `cat remove_colors_args`  output.png
It is scripty, requiring multiple commands and output re-processing, but it should work for a small number of unique colors.

If anyone has a better idea, or a way to replace one colormap for another, PLEASE let us know.

Posted: 2006-11-12T21:06:05-07:00
by anthony
If you find a better way, or even a colormap to colormap transformation, PLEASE let us know. Or you could try to add a function to do it. It is an area of IM that is lacking.

Posted: 2006-11-12T22:24:10-07:00
by anthony
The first section of txt: output is always the same. the RGB and posibly A numbers at the depth setting in force when written. Anything else should however be one or two colors of colors in a format that IM can undersand AS IS.

As such if you see 'grey8' then you can use grey8 as the color argument to IM.

See IM Examples. 'Text Image Format'
http://www.cit.gu.edu.au/~anthony/graph ... files/#txt
for more details.