0

TIFF allows for JPEG compression, among others. While it is not a well-explored option (most people just opt for lossless compression), I am looking to use it as a similar-size alternative to JPEG, which has a maximum resolution of 65535 x 65535 pixels.

Does JPEG compression for TIFF have the same limitation, or is the limitation only due to the JPEG container?

1
  • Create a tiled TIFF. Then each tile will be compressed individually with JPEG compression and file size can be as big as TIFF or BigTIFF allows. This is a standard method with geospatial images.
    – user30184
    Mar 22, 2022 at 9:23

1 Answer 1

3

At least in theory, the TIFF file format can handle bigger images. Here's a quote from a technical description of the file format:

The ISO JPEG standard only permits images up to 65535 pixels in width or height, due to 2-byte fields in the SOFn markers. In TIFF, this limits the size of an individual JPEG-compressed strip or tile, but the total image size can be greater.

Of course, that doesn't guarantee that you'll be able to find software that actually supports it.

I found that about half way down this document: https://www.awaresystems.be/imaging/tiff/specification/TIFFTechNote2.txt Which was linked from the TIFF File Format FAQ.

5
  • Just a note after a quick test - it runs into an error of JPEGPreEncode: Strip/tile too large for JPEG. I suspect it is treating the whole width/height as one strip or so. Though it may just be related to this issue
    – Elie
    Jul 13, 2020 at 2:14
  • @Elie Are you doing tile-oriented image I/O? See: Create a tiled Tiff using LibTiff.net
    – scottbb
    Jul 13, 2020 at 4:55
  • I am not sure what that means, to be honest. I was using PIL, just using save() and compression=jpeg.
    – Elie
    Jul 13, 2020 at 13:53
  • Yeah, TIFF suffers the same problem as other media "container" file formats. People expect that if two apps read and write the same kind of container, and especially if save the files with the same filename extension, then the two apps should be able to read each other's content. But that often is not the case. Jul 13, 2020 at 14:33
  • TIFF is very complex and even though I wrote I/O code for it, one day I landed on a file that could not be read... it was compliant TIFF but it was stored in columns instead of rows... I had seen it in the spec and decided not to bother because it seems a waste of time and require a considerable amount of added code but then we found out that a scanner used it to rotate images for landscape formats! Bottom is that there are many valid TIFF files that software can't read which was one reason I wrote a library.
    – Itai
    Jul 13, 2020 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.