[ILUG-BOM] Tiff image support in QT

Rahul Torvi torvir@[EMAIL-PROTECTED]
Mon Dec 17 15:42:22 IST 2001

Hi all,

I am loading an image using QPixmap and successfully displaying the
image in the client area of the application.

But when I am working with TIF image, it is unable to load it in the
QPixmap, TIFF format is not in the supported format list of QT, So when
I searched, I got the following TWO options to support TIFF format in

First is QImageFormat's decoding procedure to install the new format.
where you have to override DecoderFor, FormatName and Decode. Which I
was unable to do, So any help in this case would be really appreciated.

Secondly, I got the following code for defining the new format support.
Which is crashing after the last line of the code.

My code goes this way

QImageIO::defineIOHandler( "TIF",                  // format name
                             "\\x49\\x49\\x2A\\x01",        // header-regexp
                             0,                                        //
binary format,text:"T"
                             read_tif_image,                    //
                             write_tif_image );                 //

QImageIO *myImageIO;
myImageIO = new QImageIO( strFileName,"TIFF"/"TIF");     //tried with TIFF
and TIF
QIODevice  *d = myImageIO->ioDevice();
QDataStream s( d );
const       buflen = 24;
char        buf[buflen];

d->readBlock( buf, 4 );                                    // read signature

Waiting for an early reply...

Best Regards

Rahul T.

More information about the Linuxers mailing list