Question

With ImageMagick shell command (convert?)...

Given a colorful input.png image.

How to us input.png to produce a white output.jpg version with similar dimensions an opacity of 100% ?

I will later on use this layer in my workflow.

Was it helpful?

Solution 2

You could use fill, like this:

convert input.png -fill "#ffffff" output.jpg

or

convert input.png -fill white output.jpg

Or you can convert all three channels (red, green and blue) to "1" which is full intensity, like this:

convert input.png -channel red -fx "1" -channel green -fx "1" -channel blue -fx "1" output.jpg

OTHER TIPS

This should work:

convert input.png -threshold -1 output.jpg

This transforms any pixel with an intensity greater than (-1), i.e., all of them, to white. It does not work with GraphicsMagick, though, because in GM the threshold value is unsigned (in ImageMagick it's a signed "double"). Neither of the applications documents exactly what is supposed to happen when the threshold is negative.

Here's a command that works on both ImageMagick and GraphicsMagick, and is documented:

[gm] convert input.png -fuzz 100% -fill white -opaque gray output.jpg
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top