Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert jpg image to transparent png image using Imagick #15

Open
CHANDRA-BHUSHAN-SAH opened this issue Mar 18, 2016 · 0 comments
Open

Comments

@CHANDRA-BHUSHAN-SAH
Copy link

Hello,
I want to convert a jpg image file to transparent png image file for this I am using ImageMagick commands as follows

  1. convert original.jpg -fuzz 2% -transparent white fuz.png
  2. convert fuz.png -fx 'a==0 ? HotPink : u' tmp.png
  3. convert tmp.png ( +clone -fx 'p{0,0}' ) -compose Difference -composite -modulate 100,0 -alpha off dif.png
  4. convert dif.png -bordercolor black -border 2 -threshold 2% -blur 0x3 msk.png
  5. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant