Post without Account — your post will be reviewed, and if appropriate, posted under Anonymous. You can also use this link to report any problems registering or logging in.

RT 84665 - g4 compression feature request

  • 1 Replies
  • 1376 Views
*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 417
    • View Profile
RT 84665 - g4 compression feature request
« October 20, 2016, 07:11:28 PM »
Subject:    g4 compression feature request
Date:    Tue, 16 Apr 2013 14:42:23 +0200
To:    <bug-PDF-API2 [...] rt.cpan.org>
From:    "Mark J. Nelson" <mjas [...] itu.dk>
 
Hi,

A feature request, forwarded from the Debian bug tracker:

Some scan/fax users of PDF::API2 run into an unsupported type of compression. In particular, in PDF::API2::Resource::XObject::Image::TIFF,

Code: [Select]
if(ref($tif->{imageOffset}))
{
     die "chunked ccitt g4 tif not supported.";
}

I'm not familiar enough with what would be needed to add support to know how reasonable a request this is, however.

Debian bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=549653

Best,
Mark

--
Mark J. Nelson
IT University of Copenhagen
http://www.kmjn.org/
 
#
Thu Jun 12 23:50:27 2014 steve [...] deefs.net - Subject changed from 'g4 compression feature request' to 'Add CCITT Group 4 compression support to TIFF decoder'
#
Thu Jun 12 23:50:27 2014 steve [...] deefs.net - Severity Wishlist added
#
Fri Jun 13 00:11:29 2014 steve [...] deefs.net - Correspondence added
Subject:    Update CCITT Group 4 compression support in TIFF decoder
 
This needs some more research.  Based on the Debian bug (which claims that G3 is being used, not G4), the error message may be incorrect.

Regardless, adding support requires either expanding the CCITT decoder or replacing it with another module.  A quick search of CPAN didn't turn up anything (except maybe the Imager module).

See the following URLs for Group 4 specification details:
http://www.digitalpreservation.gov/formats/fdd/fdd000136.shtml
http://www.itu.int/rec/T-REC-T.6-198811-I/en

The TIFF specification is here:
https://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf
#
Fri Jun 13 00:11:29 2014 The RT System itself - Status changed from 'new' to 'open'
#
Fri Jun 13 00:11:51 2014 steve [...] deefs.net - Subject changed from 'Add CCITT Group 4 compression support to TIFF decoder' to 'Update CCITT Group 4 compression support in TIFF decoder'

<formatting cleanup - Mod.>
« Last Edit: May 01, 2017, 10:33:14 AM by Phil »

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 417
    • View Profile
Re: RT 84665 - g4 compression feature request
« Reply #1: December 25, 2017, 01:51:30 PM »
 PhilterPaper commented on Nov 20

I have some CCITT G3 and G4 TIFFs from a file info website, per AWare Systems TiffTagViewer 2.00. The G3 TIFFS cause something in image_tiff to spew lots of crap and then hang. The G4 TIFFS die with an error message "Unknown/unsupported TIFF compression method with id '4'". G3 is compression method 2, 3, and 32771, while G4 is 4. Looks like some code fixing to do (118047 Graphics::TIFF didn't fix this one).

Add: much improved, but still not there. After many hours of debugging, I found that new Graphics::TIFF-using code was writing to object member 'stream' instead of ' stream'. Fixing that cured the spew problem. G4 was unsupported because there was no check for G4 in the supported compression modes list. Right now I'm processing it the same way as G3, which may or may not be correct. So what most of the G3 and G4 samples do now is fail to display with "insufficient data for an image". My suspicion at the moment is that a loop is ending one too early, leaving the image data stream a little short. More debugging tomorrow. Some sample G3 TIFFs are all black, which is probably a different problem.

 PhilterPaper commented 29 days ago

I think I have this sorted out, using Jeff's new Graphics::TIFF. The principal problem seemed to be that the TIFF examples I was using for G3 and G4 were Fill Order Lsb2Msb (Lsb first), which is the opposite of what PDF expects. Swapping each byte end-for-end seems to have fixed this. There is something odd about the BlackIs1 flag, in that it has to be flipped to get black writing on white paper.

I'm sure there are many TIFF parameter combinations which are not yet supported, but at least this issue and 118047 can be laid to rest. We'll just have to deal with other failing TIFFs one at a time.

PhilterPaper closed this 29 days ago