Am Wed, 19 Nov 2014 00:35:09 +0100 schrieb Marco Leise <[email protected]>:
> > I have working PNG export in my image processing package, part of dlib: > > https://github.com/gecko0307/dlib > > There're also importers for BMP and TGA. > > I also just wrote a TGA importer and found RLE and 16-bit in > particular badly supported on Linux. E.g. eye-of-gnome > (Gnome's picture viewer) doesn't correctly restore the last > pixel's color in an RLE image and most software doesn't handle > 16-bit at all. Add to that, that the specs are not very > specific as to what allowed values are and you get all > sorts of funny implementations quirks. For example: - the original Targa paint software TIPS used to store a palette even for TrueColor images, meaning you should actually calculate the data offset as header + id + palette even for 24- and 32-bit images. - the number of channels for a TrueColor TGA is always 3, plus as many attribute bits as given in the descriptor. If you only support 8-bits per color channel, you should check if bitsPerPixel is >= 24. Otherwise, bitsPerPixel == 16 would be interpreted as a two color channel image instead of three channels à 5-bits. And bitsPerPixel == 15 would become a one channel image. :p The 15-/16-bit variants were used quite a bit in the early days of 3D games, like in the menu graphics for "Trespasser". They are the same except that 16-bit allows for an additional attribute bit that could be used for a transparency mask. -- Marco
