(none) imager-devel
/ help / lists / applications / search /
 

Re: Cant read TIFF file: core dump (fwd)

From: Neeraj - Khandelwal (
05083@xyz.molar.is)
Date: Wed 23 Jan 2002 - 19:29:41 UTC


Thanks, that did the job. I have another problem on my hands now though
:-(

I opened the same tiff file in my script and wrote is back without doing
anything on it. The size of the tiff file shrank by more than half. Does
this mean that the saved image has lost information?

My actual intention was to render some text on the image. When I uncomment
the '$i->string' line from the script below, I cant find anything written
on the image. Am i missing something here?

Heres the simple script I am using ( stripped down from the simplelogo
example on the doc site):

----------
#!/usr/bin/perl -w

use Imager qw(:handy);
use strict;
use vars qw($i $fname $font @bbox $xs $ys $string $d $wx $shadowcolor
$logocolor $bgcolor);

$string='Test';

$i=Imager->new();
$i->read(file=>"test.tiff") or die $i->errstr; # gets type from name

$fname= $ARGV[0] || "../../fonts/denmark.ttf";
$font=NF(file=>$fname,size=>30) or die "Couldn't create font:
$Imager::ERRSTR\n";
$logocolor=NC(255,0,0);

# write the string on the image
#$i->string(font=>$font,string=>$string,x=>15, y=>40, color=>$logocolor);

$i->write(file=>"slogo.tiff", type=>'tiff');

-----------------

-thanks
Neeraj

On Wed, 23 Jan 2002, Arnar Mar Hrafnkelsson wrote:

> Yes - that's the result of running diff -u.
>
> Once you have the patch in a text file (named tiff_39.patch) you can apply
> the patch as described below.
>
> I've also put a patched version of the file at:
>
> http://imager.perl.org/addi/tiff.c
>
> You can just replace the std. tiff.c with that and recompile.
>
> -- Arnar.
>
>
> On Wed, 23 Jan 2002, Neeraj - Khandelwal wrote:
>
> >
> > My apologies, but I am not sure what the text patch reads. Is it output
> > from running the diff utility on the newer and the older tiff.c ?
> >
> > Many thanks
> > Neeraj.
> >
> >
> >
> > On Tue, 22 Jan 2002, Arnar Mar Hrafnkelsson wrote:
> >
> > >
> > > The crash is caused by a call to a function pointer that is NULL. We
> > > haven't implemented the sizeproc() method that libtiff uses. It doesn't
> > > usually call this method (I've never seen a file which makes it do
> > > so). But it does this as a compatability check against files which have
> > > zero in some fields because some broken software puts zeros when it
> > > doesn't know what values to put in those fields.
> > >
> > > I've included a patch (as a uuencoded message and also as raw text) that
> > > can be applied to 0.39 with something like : patch < tiff_39.patch
> > >
> > > For this case it works fine - I'm not sure if there are other cases hidden
> > > inside libtiff where it wants to know filesize when not using it's mmap()
> > > interface (which we are currently not using but will later).
> > >
> > > If someone cannot apply the patch or extract it from the message I'll put
> > > a patched tiff.c up on the web.
> > >
> > > -- Arnar
> > >
> > >
> > >
> > >
> > >
> > > begin 664 tiff_39.patch
> > > M+2TM('1I9F8N8PE4=64@2F%N(#(R(#(Q.C0R.C4U(#(P,#(**RLK('1I9F8N
> > > M8PE4=64@2F%N(#(R(#(Q.C0S.C`Q(#(P,#(*0$`@+34W+#8@*S4W+#$R($!`
> > > M"B!]"B`*(`HK"BMS=&%T:6,@=&]F9E]T('-I>F5P<F]C*'1H86YD;&5?="!X
> > > M*2!["BL)<F5T=7)N(#`["BM]"BL**PH@+RH*(#UI=&5M(&E?<F5A9'1I9F9?
> > > M=VEO;"AI9RP@;&5N9W1H*0H@"D!`("TY-2PW("LQ,#$L-R!`0`H@"0D@("`@
> > > M("`@*%1)1D9296%D5W)I=&50<F]C*2!I9RT^=W)I=&5C8BP*(`D)("`@("`@
> > > M("A4249&4V5E:U!R;V,I(&-O;7!?<V5E:RP*(`D)("`@("`@("A4249&0VQO
> > > M<V50<F]C*2!I9RT^8VQO<V5C8BP*+0D)("`@("`@("A4249&4VEZ95!R;V,I
> > > M(&EG+3YS:7IE8V(L"BL)"2`@("`@("!I9RT^<VEZ96-B(#\@*%1)1D93:7IE
> > > M4')O8RD@:6<M/G-I>F5C8B`Z("A4249&4VEZ95!R;V,I('-I>F5P<F]C+`H@
> > > M"0D@("`@("`@*%1)1D9-87!&:6QE4')O8RD@3E5,3"P*(`D)("`@("`@("A4
> > > =249&56YM87!&:6QE4')O8RD@3E5,3"D["B`@(`H`
> > > `
> > > end
> > >
> > >
> > >
> > >
> > > # actual patch follows
> > >
> > > --- tiff.c Tue Jan 22 21:42:55 2002
> > > +++ tiff.c Tue Jan 22 21:43:01 2002
> > > @@ -57,6 +57,12 @@
> > > }
> > >
> > >
> > > +
> > > +static toff_t sizeproc(thandle_t x) {
> > > + return 0;
> > > +}
> > > +
> > > +
> > > /*
> > > =item i_readtiff_wiol(ig, length)
> > >
> > > @@ -95,7 +101,7 @@
> > > (TIFFReadWriteProc) ig->writecb,
> > > (TIFFSeekProc) comp_seek,
> > > (TIFFCloseProc) ig->closecb,
> > > - (TIFFSizeProc) ig->sizecb,
> > > + ig->sizecb ? (TIFFSizeProc) ig->sizecb : (TIFFSizeProc) sizeproc,
> > > (TIFFMapFileProc) NULL,
> > > (TIFFUnmapFileProc) NULL);
> > >
> > >
> > >
> > >
> >
> >
> >
>
>