4 ms·
That's probably because of how simple the format can be, with basically a header and footer tacked on to some RGBA data. Surprisingly, with PNG, the deflate co
by klodolph 5y ago
That's probably because of how simple the format can be, with basically a header and footer tacked on to some RGBA data.
Surprisingly, with PNG, the deflate compression can slow you down, depending on what you are doing with the data. Saving a little bit of IO when you're accessing local data can turn out to be a losing proposition. TGA makes it easier to just shove pixels around, from program to program. TGA has all sorts of weird options which you can ignore, but with PNG, compression is mandatory.
- jfrunyon 5y agoI believe PNG supports uncompressed files, usually with a compression level = 0.
- klodolph 5y agoThe data is still a Deflate stream, it's just that the deflate stream will be a series of literal blocks. The idea behind "uncompressed" is that you can just copy the data into memory, and level = 0 does not achieve that (you still have to decode the deflate stream).
- jfrunyon 5y ago... what decoding needs to be done on a series of literal blocks?
- NL807 5y agoNot only that, but you can use TGA to write 16-bits per channel, which is very useful for raw data, or linear RGB colour spaces.
- jamesfinlayson 5y agoHalf-Life is a little old but I wrote a parser for the .tga files it uses and it was simple (but reading the full spec... yeah it can get complicated with all the different flags).