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

Unable to add Group3/Group4 TIFFs into Version 1.2.0 #91

Closed
jsorah opened this issue Aug 8, 2018 · 4 comments
Closed

Unable to add Group3/Group4 TIFFs into Version 1.2.0 #91

jsorah opened this issue Aug 8, 2018 · 4 comments

Comments

@jsorah
Copy link

jsorah commented Aug 8, 2018

Hello, when trying to add a Group3 or Group4 TIFF image into a PDF in release 1.2.0, there is an exception thrown by the underlying sanselan library for "unknown compression":

ExceptionConverter: org.apache.sanselan.ImageReadException: Tiff: unknown compression: 4

	at org.apache.sanselan.formats.tiff.datareaders.DataReader.decompress(DataReader.java:135)
	at org.apache.sanselan.formats.tiff.datareaders.DataReaderStrips.readImageData(DataReaderStrips.java:96)
	at org.apache.sanselan.formats.tiff.TiffImageParser.getBufferedImage(TiffImageParser.java:505)
	at org.apache.sanselan.formats.tiff.TiffDirectory.getTiffImage(TiffDirectory.java:163)
	at org.apache.sanselan.formats.tiff.TiffImageParser.getBufferedImage(TiffImageParser.java:441)
	at com.lowagie.text.ImageLoader.getTiffImage(ImageLoader.java:163)
	at com.lowagie.text.Image.getInstance(Image.java:363)

This was working previously in version 1.0.5, I presume because the method by which TIFFs were read has changed.

My initial research indicates that Group3/Group4 support was added to some later version of the sanselan/commons-imaging project, but unsure of how stable these releases are.

@andreasrosdal
Copy link
Contributor

andreasrosdal commented Aug 8, 2018

Yes, the reason for this is that images are now read by Apache Sanselan (Commons Imaging), which seems to be unable to read those types of TIFF images.

@andreasrosdal
Copy link
Contributor

I have been able to reproduce this problem with loading .TIFF files with group 3/4, with Apache Sanselan version 0.97-incubator.

I have tested Apache Commons Imaging version 1.0-SNAPSHOT, and that was fortunately able to load a .TIFF image with Group 3 correctly. So in time, this will work correctly, once Apache Commons Imaging has a proper maven release to the public maven repo.

I have updated the master branch of OpenPDF to use Apache Commons Imaging version 1.0-SNAPSHOT.

@jsorah Can you perhaps please try the latest master branch and see if that works correctly?
Do you have any suggestions about how to improve this? The old method of loading .tiff files had to be removed, and this project must use a software library to load .tiff files from now on.

@jsorah
Copy link
Author

jsorah commented Aug 9, 2018

@andreasrosdal I pulled the latest master version and ran it on my code and it is working correctly now.

Unfortunately I do not have many suggestions on how to improve this - it certainly makes the most sense to offload this piece to another project. I think the downside is that commons-imaging has been "in progress" for many years at this point.

Thanks for looking at this so quickly, I just wanted to note the issue and not so much make you feel like you had to fix it :-).

@andreasrosdal
Copy link
Contributor

As described in issue #92, a new release of Commons-Imaging is likely to come very soon,
accoding to my request on the Commons mailinglist: http://mail-archives.apache.org/mod_mbox/commons-dev/201808.mbox/browser

(Closing as a duplicate of #92).

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