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

Support for TIFF compression types 3 and 4 (CCITT Group 3/4 Fax encoding) #61

Closed
hmashlah opened this issue Sep 3, 2014 · 13 comments
Closed
Milestone

Comments

@hmashlah
Copy link

hmashlah commented Sep 3, 2014

I am trying to read the following image https://www.dropbox.com/s/zpjfppfjcz0emb8/image.tiff?dl=0
The imageio plugins are loaded and I can read other tiff images, but when I try reading this specific one ImageIO.read(new FileInputStream("image path")) returns null

@haraldk
Copy link
Owner

haraldk commented Sep 3, 2014

Hi Hazem,

Thanks for reporting!

My TIFFImageReader does not yet support "CCITT Group 3 fax encoding" aka T4 or "CCITT Group 4 fax encoding" aka T6 (TIFF compression tag constants 3 and 4) as these are not "Baseline" TIFF Class B compression types. Your TIFF file uses the former compression.

I'd like to support these compression types in the future, as they are very common. Feel free to submit a patch, if you have some time! :-)

If not, I'll look into it when I find the time.

Best regards,

Harald K

@haraldk haraldk changed the title Can not load a tiff image Support for TIFF compression types 3 and 4 (CCITT Group 3/4 Fax encoding) Sep 3, 2014
@haraldk haraldk added this to the 3.1 milestone Sep 3, 2014
@haraldk haraldk modified the milestones: 3.1, 3.2 Jan 6, 2015
@dhartford
Copy link

I am very interested in this, and although a side-request, a 'best usage' of Twelvemonkeys for taking a TIFF, split out some pages, and create a new TIFF with those selected pages (something we did with the old JAI library). Reference thread around this common challenge: http://stackoverflow.com/questions/17770071/splitting-a-multipage-tiff-image-into-individual-images-java

@sylvainmouquet
Copy link

+1 CCITT 4

@haraldk
Copy link
Owner

haraldk commented Feb 24, 2015

Hi guys,

I'd really like to implement it, it's on the list but didn't make it to 3.1. If anyone has some spare time to implement the T4 and T6 decompression algorithms, I'd be very happy to integrate that (bilevel reading is already fully done). :-)

Otherwise, stay tuned.

Harald K

@THausherr
Copy link

Maybe a possible idea for the Google Summer of Code? Github has been accepted as organization. It is still a lot of work mentoring the student (in my case: 5-10 hours a week), but less than coding it yourself :-)

@haraldk
Copy link
Owner

haraldk commented Mar 4, 2015

@THausherr That is an interesting idea! Not sure I have 5-10 hours/week available, though. And if I had, I might as well just do it myself. :-) But will definitively consider it!

Harald K

@Schmidor
Copy link
Contributor

Schmidor commented Jul 2, 2015

I'm currently trying to implement Group 3 / 4 decoding. As soon as i'm satisfied with the results i will make a pull request. However, i'm currently having problems with determining the correct reference row changing elements in Group 4 images.

@rlauck
Copy link

rlauck commented Jul 2, 2015

Is there any hope for a pure Java implementation of Group 4 en/decoding performing on par with JAI native libs?

@haraldk
Copy link
Owner

haraldk commented Jul 3, 2015

@Schmidor This is great news! I was planning to have a stab at this some time soon, but if you can make it work, that leaves me with more time for JPEG-Lossless. :-)

Let me know if I can help in any way (feel free to contact me by direct email)! I'd need to read up on the specs, and possibly need to see some code to be able to help with the exact problem you are referring to... But at least good to see that someone is working on this!

Best regards,

Harald K

@haraldk
Copy link
Owner

haraldk commented Jul 3, 2015

@rlauck Not sure. But I also don't see why not. :-)

In any case, if you need the native performance (and don't have a problem installing native libs and JNI stuff), using either JAI or even creating a separate plugin backed by LibTIFF shouldn't be a problem. The goal of this project is to have everything written in Java, for easy deployment and predictable behaviour.

Harald K

@Schmidor
Copy link
Contributor

Schmidor commented Jul 3, 2015

I think i've got it, just a wrong start index in 2d encoding.

One thing left is wheter the decoder should know about PhotometricInterpretation and output accordingly or whether it always should output WhiteIsZero and the Tiff Reader should invert it at a later stage.
Currently it always outputs BlackIsZero and the reader inverts it if the Tag is set to WhiteIsZero, so WhiteIsZero images are currently displayed inverted :)

@haraldk
Copy link
Owner

haraldk commented Jul 4, 2015

Cool!

I'll have a look (I'm currently on holiday, so it may take some time).

The idea so far has been to keep the PhotometricInterpretation out of the decoding parts, to avoid having to implement this for every possible combination of compression, predictor, interpretation, bits, etc., etc. I like to keep it that way, if you don't mind. :-)

Otherwise, this looks like a very valuable addition to the TIFF reader!

Thanks,

Harald K

@haraldk
Copy link
Owner

haraldk commented Jul 16, 2015

Fixed via #148.

Thanks @Schmidor !

Harald K

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants