Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow performance when adding an image #4

Open
JackStromberg opened this issue Oct 26, 2024 · 1 comment
Open

Slow performance when adding an image #4

JackStromberg opened this issue Oct 26, 2024 · 1 comment

Comments

@JackStromberg
Copy link

JackStromberg commented Oct 26, 2024

Describe the bug
Trying to migrate from tcpdf to tc-lib-pdf/tc-lib-pdf-image. When adding images, it takes almost 15-20 seconds more with the same image to add to the PDF between tcpdf and tc-lib-pdf. The goal is to try and set a background to a landscape page.

In tcpdf I have the following:
$pdf->Image('image.png', 0, 0, 279, 216, '', '', '', true, 300, '', false, false);

In tc-lib-pdf/tc-lib-pdf-image I have the following:
$iid01 = $pdf->image->add('image.png');
$iid01_out = $pdf->image->getSetImage($iid01, 0, 0, $page01['width'], $page01['height'], $page01['height']);
$pdf->page->addContent($iid01_out);

If I comment out $iid01_out and adding the image to the page, I still see the long load time of the image ($pdf->image->add).

Is there a different way I should import the image?

Expected behavior
Was hoping for performance to be the same or better than tcpdf.

Logs
Happy to gather additional telemetry, unsure on next steps though.

Environment:

  • OS: Debian 12
  • PHP version: 8.2
  • Version: 8.0.77 / 2.1.2

Thank you!

@nicolaasuni
Copy link
Member

Hi,
15-20 seconds is way too slow and I haven't yet observed anything like this.
Would you be able to share an image with a minimal code to reproduce this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants