§ ¶TARGA compatibility problem
Public service announcement:
If you are writing TARGA image files with run-length encoding, you should be aware that according to the official Truevision specification, it is not legal in the TARGA format to produce a run that spans scanlines. The TARGA decoder in current versions of VirtualDub strictly validates the RLE data and will flag files with RLE decoding errors if runs spanning scanlines are detected. Unfortunately, many image processing applications do not enforce this restriction and will accept such invalid files, and there are some programs out there that generate them. As much as I hate to do this, I'll probably be tweaking the TARGA decoder in the next version to allow runs that span scanlines, and probably without the evil warning that I usually do (since it's hard to do so with image import).
So, if you're making a TARGA encoder, please make sure you are not generating invalid RLE runs, and if you're making a TARGA decoder, be aware that you're going to see those in the wild, despite what the spec says.
Comments
Comments posted:
I wish some of these older formats would become extinct. I don't see any valid reason for the existance of the TARGA format, the same capabilities are included in other formats (PNG/TIFF/etc...).
Blight - 18 04 06 - 14:13
Yes, but those formats are harder to generate, and an order of magnitude harder to read. This is a major issue if, for some reason, it is impractical to bring in libpng/libtiff.
PNG uses Deflate as its compression algorithm, which is non-trivial to write a compressor for, and which requires 32K of memory for the sliding window to decompress. It actually takes more code and much more memory to implement PNG read/write support than to implement JPEG read/write, which only requires a pittance of temporary memory for a few blocks worth of image.
TIFF had the annoyance of using LZW and also suffers from tag disease: it's easy to write because it can hold anything (including JPEG), but it's horrendous to read for the same reasons.
TARGA at least has the advantage of being almost as easy to read and write as BMP, but it has RLE support for truecolor, as well as explicit alpha channel support. Anyone can hack together a TARGA writer in a couple hours at most. If you have bitmaps that RLE well, like masks, and you need very fast decompression, TGA is a better choice than PNG.
Phaeron - 19 04 06 - 02:10
FYI, you can compress PNGs with a smaller zlib window, which will reduce the amount of memory needed to decompress. pngcrush -w will do this.
Glenn Maynard - 19 04 06 - 08:38
After diligent lecture of the above,
as well as the the articles "TGA", "PNG" and "Grafikformate" of the german Wikipedia,
after arguing with my colleague about my assumed outdatedness of TIF and TGA,
after testing a .tif>.png batch conversion with IrfanView (with PNGOUT-PlugIn AND without),
not finding any Alpha Channels in PNGs saved and/or opened with Photoshop,
i am forced to correct my opinion of graphic formats and compression a bit
and might add my humble opinion to this concern as follows:
-The greatest pity is the very very poor implementation and configurability of PNG-capabilities within the obove mentioned software. Also, the compression of .png lasts too long.
-Unfortunately the common "Export" and "Properties" dialogues do not offer enough transparence about the actual header-data that's contained within or to be written into TIFs and PNGs.
-All in all i'm so very thankful for every single tiny hour som,eone spends in development of importers and exporters. How much of a difference this makes!
Apparently it is impractical for Phaeron to "share" import filters with other Developers.
Hopefully, however, one day we'll be able to drag PNGs and TIFs into VirtualDub as well.
Greets from Cologne, Germany
blausand
blausand (link) - 16 08 06 - 14:42
Comment form
Please keep comments on-topic for this entry. If you have unrelated comments about VirtualDub, the forum is a better place to post them.