Post without Account — your post will be reviewed, and if appropriate, posted under Anonymous.

[RT 124349] Slow RGBA PNG processing performance

  • 0 Replies
  • 270 Views
*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 353
    • View Profile
[RT 124349] Slow RGBA PNG processing performance
« February 11, 2018, 08:54:51 AM »
Subject: | Slow RGBA PNG processing performance
Date: | Wed, 7 Feb 2018 10:34:55 +0000
To: | bug-PDF-API2 [...] rt.cpan.org
From: | Dusan Vuckovic <dusan.vuckovic [...] otrs.com>

Hello,

I'm having performance issues with RGBA PNG files, when they are processed by the image_png() method.

I'm supplying two screenshot files as a reproduction sample: one is plain RGB, the other one has an alpha channel as well.

$ file screenshot-rgb.png
screenshot-rgb.png: PNG image data, 2400 x 1800, 8-bit/color RGB, non-interlaced
$ time perl -e 'use PDF::API2; PDF::API2->new()->image_png("screenshot-rgb.png")'
real 0m0.174s
user 0m0.140s
sys 0m0.022s
$ file screenshot-rgba.png
screenshot-rgba.png: PNG image data, 2400 x 1800, 8-bit/color RGBA, non-interlaced
$time perl -e 'use PDF::API2; PDF::API2->new()->image_png("screenshot-rgba.png")'
real 0m40.619s
user 0m40.412s
sys 0m0.134s

The difference in time needed to process both files is staggering. Is there any possibility to speed this up? The difference in file size is less than 30kB.

Distribution: PDF-API2-2.033
Perl version: 5.18.2
OS: Mac OS 10.13.3 (Darwin Kernel Version 17.4.0)

Thank you for your help!
Regards, Dusan

<file screenshot-rgb.png too large to attach. get from GitHub (#85)>
<file screenshot-rgba.png too large to attach. get from GitHub (#85)>