ImagickDemos
ImagickDemos copied to clipboard
Convert jpg image to transparent png image using Imagick
Hello, I want to convert a jpg image file to transparent png image file for this I am using ImageMagick commands as follows
- convert original.jpg -fuzz 2% -transparent white fuz.png
- convert fuz.png -fx 'a==0 ? HotPink : u' tmp.png
- convert tmp.png ( +clone -fx 'p{0,0}' ) -compose Difference -composite -modulate 100,0 -alpha off dif.png
- convert dif.png -bordercolor black -border 2 -threshold 2% -blur 0x3 msk.png
- convert original.jpg -bordercolor white -border 2 msk.png -alpha Off -compose CopyOpacity -composite target.png
In these commands "original.jpg" is the original image and "target.png" is the required png image. By using these commands I am able to do what I required but I want to do the same in PHP using Imagick.
So, please anybody provide the Imagick php code for the same.
Thank