I have a PNG image with an alpha channel (i.e. transparency), and I need to create versions with the image layer composed onto a white background. I want to use a scriptable command using a CLI tool such as Image Magick to directly convert PNG to PNG losslessly.
An example of a non-working Image Magick command which results in an error is:
convert input.png -background white -flatten output.png
This works for me:
convert -flatten img1.png img1-white.png
-flatten
command-line option-layers
command-line option (-flatten
is equivalent to -layers flatten
)