in Other by

Can Someone Advise how to change the images as below

ImageMagick: put white background under transparent PNG, then invert colors

I have a PNG image with a black shape on transparent background. I need a white shape on a solid black background instead.
How can I achieve that with Imagemagick?
Image example:
enter image description here

I want this:

enter image description here

1 Answer

0 votes
by
The image you posted is not transparent. It has an opaque checkerboard background. However, if it was transparent, this Imagemagick command should work.

convert image.png -background white -flatten -negate result.png

If using Imagemagick 7, then change convert to magick
...