views:

315

answers:

2

I've got some PNG images with transparency, and I need to create versions with the image layer composed onto a white background. I've tried various things with Image Magick "convert" operations, but either nothing happens at all or I get an error. I don't want to go to an intermediate JPG form because I don't want the artifacts. Of course it's easy to do this in Gimp or Photoshop or whatever, but I'd really rather script it from the command line because there are many of these things.

An example of a non-working Image Magick command is:

convert img1.png -background white -flatten img1-white.png

That results in an error.

Thanks!

A: 

Welp it looks like my decision to install "graphics magick" over "image magick" has some rough edges - when I reinstall genuine crufty old "image magick", then the above command works perfectly well.

Pointy
+2  A: 

this work for me

convert -flatten img1.png img1-white.png
remosu
Somehow this doesn't work for me... I tried "-transparent-color white", but got an exception/warning.
William
It turns out that I need to set the -background to white as well. I also had to download the colors.xml, which was missing.
William