Replace transparency in PNG images with white background

-background white -alpha remove -alpha off

Example:

convert image.png -background white -alpha remove -alpha off white.png

Feel free to replace white with any other color you want. Imagemagick documentation says this about the -alpha remove operation:

This operation is simple and fast, and does the job without needing any extra memory use, or other side effects that may be associated with alternative transparency removal techniques. It is thus the preferred way of removing image transparency.


This works for me:

convert -flatten img1.png img1-white.png

Documentation references:

  • -flatten command-line option
  • -layers command-line option (-flatten is equivalent to -layers flatten)