php-qrcode-detector-decoder icon indicating copy to clipboard operation
php-qrcode-detector-decoder copied to clipboard

Images with more than one qrcode do not work

Open steinm opened this issue 3 years ago • 5 comments

If the image contains more than one qrcode it doesn't decode any of them.

steinm avatar May 11 '21 13:05 steinm

114600906-barcode-and-qr-code-vector-set (1)

This is an example image which even causes a php fatal error due to an exhausted memory size

PHP Fatal error: Allowed memory size of 343932928 bytes exhausted (tried to allocate 268435464 bytes) in khanamiryan/qrcode-detector-decoder/lib/IMagickLuminanceSource.php on line 60

steinm avatar May 11 '21 13:05 steinm

this is crazy. why would you decode such things? even phone and QR code scanners cannot read those all in our go. you need to cut this into many images and do some loops.

In case I'm wrong and you manage to pull this, please share. someone might need that. happy coding :-)

jeorlie avatar Jun 01 '21 04:06 jeorlie

It might be crazy to decode this one, but it causes a fatal error because of its memory consumption. Other images show the same behaviour.

steinm avatar Jun 01 '21 13:06 steinm

Zbarimg (a command line tool) is capable of finding and decoding several barcodes in one image returning one code per result line. Unfortunately it doesn't do the job very good (often not finding the bar codes). Unfortunately khanamiryan/php-qrcode-detector-decoder is not capable of detecting bar codes in larger images (like a png of a sheet of paper), one instance would take up more than 1 GB of RAM to process the image.

benediktcarda avatar Aug 16 '21 08:08 benediktcarda

@benediktcarda This seems to a limitation of the Zxing platform that was ported to PHP here. Zxing can also only extract one bar code per image.

dearsina avatar Dec 12 '21 12:12 dearsina