Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Image errors with PDF::API2;

by tangent (Parson)
on Nov 16, 2021 at 20:32 UTC ( [id://11138908]=note: print w/replies, xml ) Need Help??


in reply to Image errors with PDF::API2;

I tried your code with two 24bit images, one interlaced the other not. It worked fine with the non-interlaced image but failed with the same error as yours for the interlaced image.

I was able to get it working by using GD to handle the image:

use GD; # ... my $imageFile = "image-24bit-interlaced.png"; my $gdimg = GD::Image->new($imageFile); my $img = $pdf->image_gd($gdimg); my $image = $page->gfx; $image->image($img, 0/mm, 100/mm);
It produced a new PDF with the image placed. I did get a warning though:
libpng warning: Interlace handling should be turned on when using png_read_image
This is a bug in libpng addressed in this discussion.

PS the module version you are using is very old - if you are planning to use it more you should update to the latest version. If you do you will need to update a few lines of your code also.

Replies are listed 'Best First'.
Re^2: Image errors with PDF::API2;
by Fletch (Bishop) on Nov 16, 2021 at 21:28 UTC

    Everything involved here is very old. Going by the info from elsewhere in the thread this is running on Centos 6 (edit and even an extremely ancient version of that, 6.5 rather than the "latest" 6.10) which went EOL just shy of a year ago (see here). OP would be much better served getting onto a newer platform and trying to get things working there rather than attempting to work around decade-ish old bugs.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11138908]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (None)
    As of 2024-04-25 04:02 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found