extract colors from one image, other as white
Posted: 2014-06-12T23:44:50-07:00
now what I am doing,
rem extract #00FF00, other as white
convert input.png -fill white +opaque "#00FF00" temp1.png
rem extract #FFFFD5, other as white
convert input.png -fill white +opaque "#FFFFD5" temp2.png
rem make it transparent
convert temp1.png -transparent white temp1_transp.png
convert temp2.png -transparent white temp2_transp.png
rem make 2 transparent png together
composite temp1_transp.png temp2_transp.png temp3.png
rem make the transparent white
convert temp3.png -background white -flatten result.png
can it do it in a single command ? because I need tens of colors and my code is not quite scalable, and skip the creation of temp image.
thanks.
rem extract #00FF00, other as white
convert input.png -fill white +opaque "#00FF00" temp1.png
rem extract #FFFFD5, other as white
convert input.png -fill white +opaque "#FFFFD5" temp2.png
rem make it transparent
convert temp1.png -transparent white temp1_transp.png
convert temp2.png -transparent white temp2_transp.png
rem make 2 transparent png together
composite temp1_transp.png temp2_transp.png temp3.png
rem make the transparent white
convert temp3.png -background white -flatten result.png
can it do it in a single command ? because I need tens of colors and my code is not quite scalable, and skip the creation of temp image.
thanks.