Overlay an image with transparency
Posted: 2012-03-10T15:46:07-07:00
Hi,
I have this image http://i.imgur.com/aQeyj.png and want to overlay this image http://i.imgur.com/FhDDb.png to color every second icon. As you can see, both images have transparent backgrounds.
After reading these forums and a lot of trial and error I came up with this code:
It somewhat works: http://i.imgur.com/qIukE.png
But if you look closely the colored icons look much more washed out than it's gray counterparts. The reason seems to be that the Alpha-Channel is much sharper defined in the original than in the colored versions. Here's a screenshot of the Alpha-Channel I made in Gimp (zoomed in): http://i.imgur.com/9PbTJ.png
So I guess my question is, how do I color the icons without loosing the sharpness or the transparent background?
I have this image http://i.imgur.com/aQeyj.png and want to overlay this image http://i.imgur.com/FhDDb.png to color every second icon. As you can see, both images have transparent backgrounds.
After reading these forums and a lot of trial and error I came up with this code:
Code: Select all
convert $TEMP/darkicons.png $TEMP/activemask.png \
\( -clone 0 -alpha extract \) \
\( -clone 0 -clone 1 -compose overlay -composite \) \
-delete 0,1 +swap -alpha off -compose copy_opacity -composite $OUT/sprite.png
But if you look closely the colored icons look much more washed out than it's gray counterparts. The reason seems to be that the Alpha-Channel is much sharper defined in the original than in the colored versions. Here's a screenshot of the Alpha-Channel I made in Gimp (zoomed in): http://i.imgur.com/9PbTJ.png
So I guess my question is, how do I color the icons without loosing the sharpness or the transparent background?