Question

I'm having a missue with a convertion.

Using a simple QR code with a white background and a black QR code, I wan't to have ImageMagick to make the white color transparent.

To do so, I tried this:

/usr/bin/convert ./qr_original.png -transparent white ./qr_transparent.png

This convert command makes the black color transparent but preserves the white background.

But trying with a QR code with a background and a red/green/blue/whatever QR code, the convert command works fine - the red/green/blue/whatever QR code is preserved and the white background gets transparent.

How come? And how can I make this work correctly?

Was it helpful?

Solution

Your code works for me. Maybe update your imagemagick?

Otherwise try this:

exec("convert ./qr_original.png -channel matte -fuzz 50%% -fill transparent -opaque white ./qr_transparent.png");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top