0

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?

Alain Tiemblo
  • 36,099
  • 17
  • 121
  • 153
Repox
  • 15,015
  • 8
  • 54
  • 79

1 Answers1

0

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");
Lukas Nagel
  • 139
  • 1
  • 2