TGA support for KDE

Dominik Seichter domseichter at
Mon Jan 27 14:39:01 GMT 2003


Am Montag, 27. Januar 2003 09:41 schrieb Matthias Welwarsky:
> On Monday 27 January 2003 03:01, Malte Starostik wrote:
> > On Sunday 26 January 2003 22:37, Dominik Seichter wrote:
> > > RLE compressed TGA files start with 0x00 0x00 0x0a and I use the
> > > following header to match them: ^\x01\x01\x0a
> > > Uncommpressed TGA images start with 0x00 0x00 0x02, but I can't match
> > > them using the header ^\x01\x01\x02 . What is wrong with this reg
> > > expression?
> >
> > Do you have a current version of kdelibs/kimgio/ico.kimgio?
> > I recently changed the Header regex for .ico/.cur files from \001\001 to
> > \001\001[\001|\002]\001 so if you still have the old version, it might
> > match on TGA. Grr, doesn't it suck that both TGA and ICO/CUR have no real
> > "magic" header? A .cur (Windows cursor, essentially the same as .ico)
> > file starts with 0x00 0x00 0x02 0x00, so any TGA with that start will
> > still be considered a CUR file if the ico/cur reader is registered first
> > and all .cur files will be treated like a TGA if that reader is
> > registered first.
> >
> > -Malte
> Couldn't this be solved by using a "longest match" strategy instead of a
> "first match"? I mean, collect "Header" lines from all registered codecs
> and consider the more exact (meaning: the longer) ones first?
This would be the best solution for the problem. I tried to create a patch for 
qimage.cpp. I think the only function one has to modifiy is const char 
*QImageIO::imageFormat( QIODevice *d ); . I doesn't work though, but I do not 
know why. The correct format is returned, but somehow it does not get used. 
Could some please have a look on the patch and maybe figure out what is 

I cc'ed qt-bugs at, because it is a Qt issue. Perhaps someone at 
trolltech has a fixed or an idea how to fix the problem.

CU Dom
Dominik Seichter - domseichter at
Krename -
KBarcode -
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qimage_cpp_header.diff
Type: text/x-diff
Size: 1756 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list