I am sure it took you long to figure it out as to how do we change the Transparency of PNG images using ImageMagick. Same was the case with me and that is why I decided to write a post for the same.
As you might be aware, ImageMagick is really awesome tool for image manipulation. It performs Image resizing, cropping, overlapping, creating gradients and what not. However, find these options and combine them to get expected results becomes difficult at times. So it happened with me when I was trying to achieve transparency effect for an image using ImageMagick. After researching in documentation and on Google, I found the following command line option –
convert myimage.png -channel Alpha -evaluate Divide 2 anothername.png
I used Divide method to achieve 50% transparency, the figure 2 is the scale of transparency which varies from 1 to 10. So you can change the “2” in “Divide 2” and achieve the desired results. Using the above command will turn myimage.png 50% transparent and store it with the name anothername.png
Two more variants were introduced called, Divide_Src , Divide_Dst from v6.6.8-5 . As per the documentation on the official website; The formula for ‘Divide_Dst’ is Src / Dest and for ‘Divide_Src’ is Dest / Src
Hope that helps.