
TiffIO 1.2.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.
Adding the plugin in the Qt's tree (or linking it witinh your own application)
enables any Qt application to manipulate TIFF images transparently along with
all other formats already managed by Qt.
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.
Current support for reading .tif into a QImage :
-
Images created on any architecture (big endians or little endians byte
ordering, LSB or MSB bit ordering)
-
Uncompressed, or compressed images (lossless Packbits, LZW, ZIP, JPEG, bitmap
FaxG4, etc.).
-
Various color schemes (RGB, RGBA, Lab, Luv, CYMK, CIE XYZ, ...), with
optional reference white for conversion to RGB.
-
2, 4, 8, 16 and 32 bits per components RGB and RGBA images
(automatically rounded to 8 bits images, as required by Qt).
-
2, 4, 8, and 16 bits paletted images with RGB colors (always loaded as 8 bits
images, with color table truncated to 8 bits because of Qt).
-
up to 16 bits per components CIE Lab color scheme.
-
up to 8 bits per components for all the other color schemes (CYMK, Luv, etc.).
-
2, 4, 8 and 16 bits gray images (always loaded as 8 bits images, with an
allGray() linear color table).
-
Bitmap (1-bit images), loaded as a QImage bitmap (depth= 1), with a colortable.
-
Accepts TIFF multi-layered images (eg. layers from Photoshop).
-
Accepts scan-line based or tile-based images.
-
Accepts image with any storage orientation.
-
Accepts huge image size (limits from Qt and libtiff : 64k*64k ?).
Current support for writting a QImage :
-
Always store planar, scan-line based, top-left oriented images, using LZW
compression and big endians architecture.
-
Bitmaps (depth=1) as one-chanel TIFF, with BPS= 1, and MINISBLACK mode.
-
Gray images (depth= 8 bit/pixel) are one-chanel TIFF, in MINISBLACK mode.
-
Other 1 or 8 bit/pixel images are saved as PALETTE images, with up to 256 RGB
colors.
-
True color images (24 or 32 bit/pixels) are saved as 3x8 bits RGB images, or
4x8 bits RGBA images, without a colormap.
What is not supported at the time :
-
Transparency (alpha channel) when in a different plane than colors, ie. except
for reading/writting RGBA (ie. 4 channels) images.
-
Compact writting of 2 or 4 bits images (instead, they are promoted to 8 bits,
then LZW compressed).
-
Fancy capabilities of Qt4 (eg. animations, fast scaled/cropped read, choice of
compression mode and quality, etc.).
-
JPEG compression/uncompression within TIFF on win32 platform (except if you
hack the Qt distribution, or provide your own libjpeg).
See comments in TiffIO.pri for details.
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 QImageIO
architecture defined by Qt.
Source download
-
The latest sources and .pro, packaged for Qt' style qmake installation, on
either Windows or Unix platforms: WinZip and
Tar archives
RPM package of the same files, for easy rebuild on linux platforms:
src.rpm
Warning: this version is based on a beta libtiff 3.8.0++.
Release 3.8.0 of libtiff do have problems. This Beta
is from the CVS repository, of what will become libtiff 3.8.1 someday I
guess... This is to cure certain combination of YCrCb color space and
compression schemes that have been reported to crash TiffIO on the dark side of
libtiff...
-
The previous release 1.1.0c based on libtiff 3.7.4 (see
History below) is there: WinZip,
Tar archives, and src.rpm
-
Old sources are there
Pre-compiled download
None at that time: because there is too many combination of versions of Qt,
versions of compiler, and systems flavors...
Status
-
The plugin have been compiled and tested with Qt 3.2.3, Qt 3.3.5, Qt 4.0.1, and
Qt 4.1.
-
The plugin have beed compiled and tested on MacOSX, Solaris, Irix, Tru64, AIX,
Linux, HP-UX, and Windows XP (SP1 & SP2).
-
The plugin have been compiled and tested with MS Visual C++ (6, .NET and .NET
2003), with g++ (3.2 and 3.3), and mingw++.
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
-
Sometimes, Qt 4.0.1 Evaluation seems to fail to link
on windows,
when using command line qmake/nmake tools.
Use Visual environment instead (typing devenv in the Qt 4.0.1 shell window).
-
On some version of borland bcc, you will need to ignore
hundreds of spurious warnings araising from the libtiff sources, that abort
compiling somewhere in the installation.
One should be able to shut warnings off, and finish compiling. Please e-mail me
the right bcc options !
I you find some bugs, or need support never encountered before TIFF variant,
send e-mails to Jean-Dominique.Gascuel at imag.fr.
History
-
2006-02-10 / 1.2.0e :
- NEW Added support for Lab up to 3x16bits and RGB/RGBA up to 4x32bits.
- FIX demo.pro was compiled in debug, and TiffIO.pro in release.
So when using Qt4.x, they would never met...
2006-02-06 / 1.2.0d :
-
NEW
Upgrade to beta libtiff 3.8.0 (CVS), because brand 380 crash on some uncommon
TIFF features (eg. uncompressed YCrCb color space) crashes and other compile errors.
-
FIX demo for Qt4.
-
FIX bug preventing tiff to be in the list of Qt4.1 recognized
formats.
-
2006-01-11 / 1.2.0 :
-
FIX
linux-g++-64 compile (Thanks to Michael Kettner).
-
NEW
allow (but discourage) compiling with a pre-compiled libtiff.
-
FIX
bit order is different from byte order. So don't messup endianness with
LSBfirst in bitmaps (Thanks to Frank Warmerdam).
-
FIX
bug in Qt4 QIODevice API preventing writting TIFF.
-
NEW Upgrade to libtiff 3.8.0, with some patches to avoid
crashes and compile errors.
-
2005-09-29 / 1.1.0 :
-
FIX
missing checking of libtiff error code while reading/writting scan-lines.
-
FIX
TiffIO generates qWarning() on fatal libtiff error, to avoid crashing the
application.
-
FIX
support for compiling with no-jpeg, no-lzw, no-zlib qmake config options.
-
NEW
remove depedancy to GetFocus and MessageBox on win32 build.
-
NEW
Save 32 bits QImage 24 bits TIFF when no alpha, and 32 bits TIFF when the image
have an alpha channel.
-
NEW
support for statically linked code (see test.pro for an example).
-
NEW add support for Qt 4.x image IO architecture.
-
2005-06-17 / 1.0.7:
-
FIX
Upgraded to libTiff 3.7.2, due to security alerts.
-
FIX
16/32bits truncation warnings (that turns to compile errors on Boreland bcc32.
-
NEW handler to redirect TIFF errors/warnings to Qt's qFatal() and
qWarning().
This enables uniform application-wide policy using Qt's installMsgHandler().
-
NEW
Test suite now checks that unsupported files don't crash and do generate Qt
style errors/warnings.
-
NEW
Experimental support for reading 2 bits and 4 bits gray or color mapped images.
-
FIX
crash when reading bitmaps to hardware that needs a swap-bits.
-
FIX
byte swapping problem when writting 24/32 bit images on SGI.
-
NEW support for JPEG-in-TIFF when the Qt installation contains sources,
or on unix with libjpeg 6.2 devel package.
-
2005-03-22 / 1.0.6:
-
NEW Added support (and self-test) for bitmaps i/o, and FaxG4 reading.
-
2005-02-01 / 1.0.5:
-
NEW
self-test program and examples files.
-
FIX compiler issues on HP-UX and AIX, thanks to Till Oliver Knoll.
-
2005-01-14 / 1.0.4:
-
FIX
Upgrade to libtiff 3.7.1, because of security alert.
-
FIX
libtiff 3.7.1 not to crash when displaying warnings or error messages.
-
FIX libtiff 3.7.1 to have readable error message when reading
unsupported pixel formats (eg. CYMK 16 bits).
-
2004-12-17 / 1.0.3:
-
FIX
Add "TIFF" as recognized format (as well as TIF).
-
FIX RGBA/ABGR color inversion on win32 platforms.
-
2004-11-22 / 1.0.2:
-
FIX a minor bug about the regexp to recognize TIFF formats.
-
2004-11-08 : Creation
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.
-
On unix :
qmake TiffIO.pro
make
sudo make install
-
On windows command line :
qmake TiffIO.pro
nmake
-
On MS Visual Studio (6, .NET and .NET2003) :
-
Generate the .vcproj with the IDE Qt icon, or with the command:
qmake -tp vc TiffIO.pro
-
Exit any Qt application (including Designer or Assistant), because they lock
the QTDIR/plugin/imageformats
directory.
-
Open the project file, and build the solution.
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).
-
Under Unix/Linux, there is usually a jpeg lib installed in /usr, or /usr/local
which TiffIO automatically detect.
-
Under MacOSX, there is no (by defaults) jpeg lib in the system, hence
you need either to install Qt with internal support for JPEG, either to disable
jpeg support from TiffIO using the qmake's option CONFIG+=no-jpeg.
-
Under Windows, you can't link against a DLL without exporting the
symbols. To use the $QTDIR/src/3rdparty/libjpeg, a solution is to
compile that library separatly, then to link your plugin against it. See
comments inside TiffIO.pri for details.
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.