Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Background color: Opposite of -transparent

Tags:

imagemagick

Say I have a PNG with transparent pixels, how could I translate them to a solid color?

(Note this is slightly different to this question as I'm looking to replace with an arbitrary color. White is "special" in ImageMagick, as the accepted answer there indicates by the fact it omits to mention white).

like image 980
mahemoff Avatar asked Jun 06 '12 12:06

mahemoff


People also ask

What is color inversion?

You can invert the colours on your device to a make it easier to read by enabling the Colour Inversion setting. This will increase The contrast between text, images and the background. Often this means the text will become white text over a black background.

How do I turn my background back to white?

Select Start > Settings > Personalization > Colors, and then choose your own color, or let Windows pull an accent color from your background.

How do you invert background color in CSS?

CSS allows you to invert the color of an HTML element by using the invert() CSS function that you can pass to the filter property. Because the default color of the text is black, the color is inverted into white with filter: invert(100%) syntax.


1 Answers

For me, the following works (ImageMagick 6.6.3-1):

convert in.png -background "#FF0000" -flatten out.png

Just swap the red color to whatever suits your needs.

like image 94
Maehler Avatar answered Nov 07 '22 20:11

Maehler