TiffIO 1.3.0
Jean-Dominique <dot> Gascuel <at> imag.fr

TiffIO is a plugin that add TIFF images read/write capabilities to all Qt3 and Qt4 applications using the QImage class.

TiffIO come with a self-test suite (test.pro), and have been compiled and used successfully on a wide variety of systems, compilers and Qt version combination. A demo application (demo.pro ) enables to quickly test image loading & viewing on any platform.

All TIFF operations are based on libtiff 3.8.0, this plugin is just a wrapper that enable to use it transparently from the QImage class, and the architecture defined by Qt.

Documentation

[Home] [Documentation] [Download] [Status] [History] [Installation]

Adding the plugin in the Qt's tree (or linking it witinh your own application) is sufficient to enable any Qt application to manipulate TIFF images transparently along with all other formats already managed by Qt.

Code snipets to reading TIFF images from a Qt application

To load a TIFF image from Qt, you can simply use the strainforward approche, as with any other image type supported :
		QImage img("Examples/rgb8-zip-mac.tif");
		if( ! img.isNull() ) // Load succeded ?
			...
	
A slightly more complex example (see the demo app), uses an image handler to get access to the description string (in Qt3) :
		QImageIO io("Examples/rgb8-zip-mac.tif");
		if( io.read() )	//Load succeeded ?
		{
			... = io.format()	// Should be "TIFF"
			... = io.image();
			... = io.description();
		}
	
Or using the new Qt4 dialect :
		QImageReader reader("Examples/rgb8-zip-mac.tif");
		QImage img = reader.read();
		if( !img.isNull() )	 //Load succceded ?
		{
			... = reader.format()	// Should be "TIFF"
			... = reader.text("description");
		}
	

Code snipets to write TIFF images from a Qt application

Saving TIFF images can be as strainforward too :
		QImage img = ...
		if( ! img.save("Temp/snapshot.tif", "TIFF") )
			qWarning("save failed !");
	
Most probably, you should stop reading here. You know whatever you really need to save portable TIFF images...

But if you are sure you really need it, you can also use hints to request particular flavours of TIFF images to be created. This is done by providing a parameters string to the Qt library. Saving a 10-bit RGB lossless compressed image, with Qt3 :

		QImage img(100, 100, 32);
		...
		QImageIO io("Temp/snapshot.tif", "TIFF");
		io.setParameters("lzw bps=10");
		if( ! io.write() )
			qWarning("TIFF image save failed");		
	
Or a 64 colors image, using 6 bit indexes, using the Qt4 dialect:
		QImage img(100, 100, QImage::Format_Indexed8);
		img.setNumColors(64);
		...
		QImageWriter writer("Temp/snapsho.tif", "TIFF");
		writer.setText("parameters", "none bps=6");
		if( ! writer.write(img) )
			...	// Failed
	
This parameter string is a blank separated list of words. Recognized words are :

TIFF support

Current support for reading .tif into a QImage :

Current support for writting a QImage :

Experimental :

What is not supported at the time :

Source download

[Home] [Documentation] [Download] [Status] [History]

Pre-compiled download

None at that time: because there is too many combination of versions of Qt, versions of compiler, and systems flavors...

Status

[Home] [Documentation] [Download] [Status] [History] [Installation]

I am using TiffIO on Win32/Qt 3.2.3, ``every days'', and I am not aware of any bugs. The self-test suite (just compile and execute the provided test.pro project) enable a quick checking of the plugin consistency for a given platform. If you have a doubt, you can also compile the demo.pro micro-application to have a look at any dubious .tiff file.

Known Bugs

I you find some bugs, or need support never encountered before TIFF variant, send e-mails to Jean-Dominique.Gascuel at imag.fr.

History

[Home] [Documentation] [Download] [Status] [History] [Installation]

Installation

[Home] [Documentation] [Download] [Status] [History] [Installation]

Pre-requisite

You should have Qt installed, and the QTDIR environement variable correctly defined. In particular, having several installation of Qt (eg. Qt3 and Qt4) installed works only if QTDIR/include, QTDIR/bin, QTDIR/lib etc. goes to the right places (eg. QTDIR=/usr/share/qt3 or QTDIR=/usr/share/qt4 under some linuxes).

On windows, to have zip compression support, you need to have installed Qt with internal zlib support, or you need to provide argument TIFF=pathToIncludeAndLib to any qmake call.

Let's do it.

If you want to track what happends in TiffIO or in the embebed libtiff, you can compile and install TiffIO_DBG.pro instead.

Qt4 plugin management

Among the changes introduced by Qt4, there is a change in the policy when loading plugins. Now, the rules specify that a plugin is suitable to load only if it has been compiled with the same version and compile options that the main app loading it. It means that in order to have the plugin running both in release and in debug mode, you should compile and install both TiffIO.pro and TiffIO_DBG.pro.

Support of JPEG compression scheme inside TIFF images

To link with Qt's internal JPEG lib, you should have installed Qt with internal JPEG, not plugin JPEG (ie. configure with option -qt-imgfmt-jpeg on Qt3), and compile without hiding symbols from a DLL (ie. not from windows).

Testing

To run the self-test program, use the test.pro and run the generated executable. It should end saying All xxx the images checked ok. The corresponding cases are in the Example/ subdirectory.

You can also see samples, by compiling the demo.pro demo viewer.