Questions about TIFF-compression

Ask for help and post your question on how to use XnView MP.

Moderators: helmut, XnTriq, xnview

Post Reply
User avatar
Peter2
XnThusiast
Posts: 1365
Joined: Thu Nov 24, 2005 3:07 pm
Location: CH

Questions about TIFF-compression

Post by Peter2 »

I don't have a deep understanding of file-formats and compressions and so on, but usually I have the experience with LZW and CCITT:
"Uncompressed TIF has high file size, compression reduces it down to 70-5% file size"

But now I got an uncompressed TIFF (6400 * 4800 pix, 16.400 colors) where I used different "save as tiff .." commands from XNViewMP and got these result:

Code: Select all

original.tif    92'305.350
jpeg.tif         6'142.974
lzw.tif         79'104.426
lzw_pre.tif     55'910.122
packbit.tif     93'066.541
no_compr.tif    92'337.107
zip.tif         66'681.857
The file props of the original are:

Code: Select all

File	
Filename	018.tif	
Filepath	D:\xxx	
Description	TIFF Image file	
File size	88.03 MiB (92’305’350)	
Creation date/time	15.03.2025 - 09:11:21	
Modified date/time	15.03.2025 - 09:11:28	
Accessed date/time	15.03.2025 - 09:36:48	
Rating	0	
Colour Label	0	
File's icon	1	

Image	
Format	TIFF	
Width	6325	
Height	4863	
Dimension	30.7585 Mpixels	
# of bits	24	
Color model	RGB	
DPI	240 x 240	
Print size	66.94x51.47 cm, 26.35x20.26 inches	
Compression	None	
Images/frames count	1	
Origin	Top-Left	

Extra info	
PhotometricInterpretation	 2	
PlanarConfiguration	 1	
SamplesPerPixel	 3	

Color Profile	
Description	sRGB IEC61966-2.1	
Manufacturer	IEC http://www.iec.ch	
Model	IEC 61966-2.1 Default RGB colour space - sRGB	
Copyright	Copyright (c) 1998 Hewlett-Packard Company	
So what's the reason that the compression brings so extreme different results and LZW only a small effect and packbit an increased size?
XnViewMP <Current version> German, XnConvert <Current version>, Win 10
cday
XnThusiast
Posts: 4394
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Questions about TIFF-compression

Post by cday »

The file size of a TIFF basically depends on:

o The bit depth (1-bit black and white, 8-bit grayscale or colour [only 24-bit and 32-bit colour supported in xnview software] of the image saved;

o Whether the compression option used is lossless or lossy [I think that all options except JPEG compression are lossless] and the alternative save settings options within the compression option selected;

o The complexity of the image content, some compression options being more efficient for particular forms of image [for example, images with large areas of the same colour, such as in a 1-bit depth image white or black areas].

In general, file sizes for colour or grayscale images will be much larger if any option other than JPEG compression is selected.

In general, for 1-bit black and white images Fax [CCITT G4] compression is very efficient, although alternative options may result in smaller file sizes for particular types of images.

Can anyone correct any of those guidelines or add other useful information?
Last edited by XnTriq on Sun Mar 16, 2025 3:30 pm, edited 2 times in total.
Reason: BBCode disabled to prevent unwanted italics
User avatar
Peter2
XnThusiast
Posts: 1365
Joined: Thu Nov 24, 2005 3:07 pm
Location: CH

Re: Questions about TIFF-compression

Post by Peter2 »

Hi cday

I always had the idea (the illusion?) that TIFF is lossles. But is it correct that a JPEG compression result in a JPEG, in the package of a TIFF?
XnViewMP <Current version> German, XnConvert <Current version>, Win 10
cday
XnThusiast
Posts: 4394
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Questions about TIFF-compression

Post by cday »

Peter2 wrote: Sat Mar 15, 2025 9:38 am I always had the idea (the illusion?) that TIFF is lossless. But is it correct that a JPEG compression results in a JPEG, in the package of a TIFF?
A JPEG compression algorithm is used, so in effect yes, whether that matters will depend on the particular use case....

I don't immediately see a situation where saving an image as a TIFF with JPEG compression would have an advantage over saving directly to a JPEG file, which would actually slightly increase the file size, but maybe there are some cases?

Edit: There is also the question of the JPEG save options used, as they are not directly accessible when saving to a TIFF, whether XnView's normal configurable options or fixed settings are used,which might result in a non-optimal image due to quality or larger file size than actually needed?
User avatar
Peter2
XnThusiast
Posts: 1365
Joined: Thu Nov 24, 2005 3:07 pm
Location: CH

Re: Questions about TIFF-compression

Post by Peter2 »

Thanks @cday,

and have a fine weekend.
XnViewMP <Current version> German, XnConvert <Current version>, Win 10
User avatar
XnTriq
Moderator & Librarian
Posts: 6512
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Questions about TIFF-compression

Post by XnTriq »

https://en.wikipedia.org/wiki/TIFF#Details wrote:TIFF is a flexible, adaptable file format for handling images and data within a single file, by including the header tags (size, definition, image-data arrangement, applied image compression) defining the image's geometry. A TIFF file, for example, can be a container holding JPEG (lossy) and PackBits (lossless) compressed images. A TIFF file also can include a vector-based clipping path (outlines, croppings, image frames). The ability to store image data in a lossless format makes a TIFF file a useful image archive, because, unlike standard JPEG files, a TIFF file using lossless compression (or none) may be edited and re-saved without losing image quality. This is not the case when using the TIFF as a container holding compressed JPEG. Other TIFF options are layers and pages.
https://libtiff.gitlab.io/libtiff/specification/index.html wrote:Draft DRAFT TIFF Technical Note #2 covers problems with the TIFF 6.0 design for embedding JPEG-compressed data in TIFF, and describes an alternative.
User avatar
XnTriq
Moderator & Librarian
Posts: 6512
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Questions about TIFF-compression

Post by XnTriq »

Software for analyzing TIFF files:
Post Reply