Menu

#2 Palette -> True Color

Unstable (example)
accepted
nobody
None
5
2013-05-20
2011-11-17
paulus
No

I had been running into a problem where the QR Codes were being read by a .Net application to be used for generating a PDF. It kept dying on importing the PNG file generated by phpQrCode and it turns out that the palette-based PNG phpQrCode generates was 1-bit (2 colors, black and white).

While the palette-based PNG is much more compact and efficient and still renders fine in other places, this particular control (or whatever it's called in .Net) wasn't having anything to do with it, generating a NullPointerException when reading the PNG image.

Sizes (based upon a QR encoding of a 50 character URL):
- Palette-Based (1-bit): 700 bytes
- TrueColor (24-bit): 2500 bytes

Quite a bit of difference in size, but sometimes it has to work for all uses.

This patch file just updates the one big file and the qrimage.php class to use ImageCreateTrueColor instead of ImageCreate.

I haven't tried this when generating JPG or EPS (that the other patch adds) but imagine that it should be fine with JPG at a minimum.

BTW: the .net control: PDFSharp 1.31 (can be found here on sourceforge)

Discussion

  • paulus

    paulus - 2011-11-17

    patch file to update to ImageCreateTrueColor

     
  • Dominik Dzienia

    Dominik Dzienia - 2013-05-20

    B&W was selected to output possible small PNG image,
    for future releases i plan to add more configuration to image output,
    for now this patch is good idea when someone needs non-paleted, RGB images.
    Thanks!

     
  • Dominik Dzienia

    Dominik Dzienia - 2013-05-20
    • status: open --> accepted
    • Group: --> Unstable (example)
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.