Skip Menu |

This queue is for tickets about the Imager CPAN distribution.

Report information
The Basics
Id: 132237
Status: new
Priority: 0/
Queue: Imager

People
Owner: Nobody in particular
Requestors: bbodi [...] web.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Imager->to_paletted non-deterministic
Date: Thu, 26 Mar 2020 17:20:53 +0100
To: bug-Imager [...] rt.cpan.org
From: Bernhard Bodenstorfer <bbodi [...] web.de>
The script below creates a QR-code, which apparently works well. Then it converts the image to a 1-bit colormap image using to_paletted, which yields different results. You see in the attachments the results qr1.png and qr2.png from two consecutive runs of the script. They differ visually and, of course, in binary. You also find attached the result qr.png of one run where I commented out the to_paletted statement. I have checked and could not observe any stochastic behaviour as long as the to_paletted is commented out. As you also notice, not only qr1.png and qr2.png differ from each other, but they also contain transparent pixels. The "original" qr.png does not. The result is reproducible in the way that with every call to the script (with to_paletted active) I get a PNG file with different transparency of the "black" pixels, and all "white" pixels are changed to transparent. use strict; use warnings; use Imager; use Imager::QRCode; my $qrcode = Imager::QRCode->new(); my $img = $qrcode->plot( "Hi!" ); # comment this out to see the difference $img = $img->to_paletted(); $img->write( file => '/tmp/qr.png', type => 'png', ); Test Environment: x86_64 GNU/Linux libpng 2:1.6.37 perl v5.30.2 Imager-1.011 Imager-QRCode-0.035
Download qr1.png
image/png 273b

Message body is not shown because sender requested not to inline it.

Download qr2.png
image/png 273b

Message body is not shown because sender requested not to inline it.

Download qr.png
image/png 612b

Message body is not shown because sender requested not to inline it.