Bug#622078: libpdf-api2-perl: occasional broken conversion of TIFF images

Jeffrey Ratcliffe jeffrey.ratcliffe at gmail.com
Thu May 3 20:21:07 UTC 2012


found 622078 2.019
thanks

I'm seeing this too

Attached are two TIFFs. The original "Word list
(French)_page0002_2R.tif" embeds fine. If I run it through

tiffcp "Word list (French)_page0002_2R.tif",0 new.tif

then although new.tif is a perfectly good TIFF, the image is corrupted
when embedding in the PDF.

#!/usr/bin/perl -w
use strict;
use PDF::API2;
use Image::Magick;

my $pdf = PDF::API2-> new(-file => 'test.pdf');
#my $tiff = 'Word list (French)_page0002_2R.tif';
my $tiff = 'new.tif';

my $image    = Image::Magick->new;
$image->Read($tiff);

# Get the size and resolution. Resolution is dots per inch, width
# and height are in inches.
my $resolution = $image->Get('x-resolution');
my $w          = $image->Get('width') / $resolution;
my $h          = $image->Get('height') / $resolution;

my $page = $pdf->page;
$page->mediabox( $w * 72, $h * 72 );

my $gfx = $page->gfx;
my $img = $pdf->image_tiff($tiff);
$gfx->image( $img, 0, 0, $w * 72, $h * 72 );
$pdf->save;
$pdf->end;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Word list (French)_page0002_2R.tif
Type: image/tiff
Size: 147376 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20120503/59c26dae/attachment-0002.tif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: new.tif
Type: image/tiff
Size: 181404 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20120503/59c26dae/attachment-0003.tif>


More information about the pkg-perl-maintainers mailing list