Live data from Hacker News

Image file formats that didn’t make it

tedium.co

61–70 of 210 posts

Re: Image file formats that didn’t make it

#62

Earlier quoted context omitted.

I think bitmaps are often used in 2d games for level definition or various other sorts of mapping (height, for 2.5d games, et c.)

Bitmap is the easiest image file format in the world to read/write and the easiest and sometimes fastest to shoot over to any video device in the history of computing. Almost every game making tutorial going back to the 80s has "how to read/write" bitmaps usually in it somewhere. Even 3D games will sometimes use them in a lot of odd places because it was faster/easier/took fewer cycles to include an uncompressed or s…

> Bitmap is the easiest image file format in the world to read/write

When making a quick hack like a toy ray tracer or Mandelbrot generator in C or C++, it's traditional to use .ppm [0] because it's trivial to write out pixel values in ASCII.

[0] https://en.wikipedia.org/wiki/Netpbm#File_formats

Re: Image file formats that didn’t make it

#63
post #50

Earlier quoted context omitted.

That was my reaction. To be fair author says: "Of the formats listed here, TIFF is probably the one most likely to still be in wide use, but it has evolved into a more specialized format for professionals, in comparison to something like JPG."

TGA files still show up in video game textures surprisingly often

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.

Re: Image file formats that didn’t make it

#64

Earlier quoted context omitted.

Bitmap is the easiest image file format in the world to read/write and the easiest and sometimes fastest to shoot over to any video device in the history of computing. Almost every game making tutorial going back to the 80s has "how to read/write" bitmaps usually in it somewhere. Even 3D games will sometimes use them in a lot of odd places because it was faster/easier/took fewer cycles to include an uncompressed or s…

That's why some games have uncompressed audio files which made the game size ballooned up. If the game have so much audio on, it would be best to use uncompressed audio as CPU don't have to spend extra resources to decode bunch of audio files at the same time when the games is asking for it.

This is a small pet peeve of mine. Even though PCs have mostly lost dedicated "sound cards" they still have dedicated hardware for sound decompression in their SoC packages. The big reason I think games often think they need so much uncompressed audio has not as much to do with hardware support as much as it is that games and general consumers "forked" on different compression paths in audio. Most consumer audio is MP3 and has been for decades, while most game audio went to patent unencumbered formats like Ogg Vorbis. Everyone has MP3 hardware decoding and almost no one has Ogg Vorbis in hardware. Even with the MP3 patents expired I think game companies just forget it exists as a well-supported lowest common denominator format with a wealth of hardware support. Sure, MP3 is a lossy compression format, but the specific losses in MP3 would hardly matter in most game soundscapes (and also Ogg Vorbis is similarly lossy, though "better" in double blind studies of single audio files).

(Some of that I think is also political/contractual in the way that using MP3 would give some additional types of PC players "free soundtracks" while using other compression formats is a bit of security through obscurity and raises the bar slightly for PC players that don't, for instance, know what Ogg Vorbis even is.)

Re: Image file formats that didn’t make it

#65
post #52
post #7

Tiff is very much not dead. It is likely one of the image formats more widely used today. Terabytes of new tiff images are prodced every hour and distributed by many remote sensing operators. It is a really flexible and robust format also. How else are you going to store a floating-point multispectral image of 8 bands and 50.000 x 50.000 pixels, arranged tile-wise for easy cropping?

The OpenEXR format, from the film industry, can also store an image with that configuration.

True, although TIFF (often used with GeoTiff) can also store 64-bit float (double), which OpenEXR doesn't support.

Re: Image file formats that didn’t make it

#66
post #6
post #4

Anecdotally, the first time I heard of TGA was in Tomb Raider. The Tomb Raider games of old had a screenshot feature that outputted TGA files of gameplay and were useful for making walk-throughs for other people (you would typically convert them to JPG when sharing on the web). And I still see BMP files being used even in modern games. Yeah: PNG is better, but BMP has its uses.

BMP and TGA have the advantage that they're uncompressed, so it's mostly trivial to dump the contents of your framebuffer to a file without any major dependencies.

Agree about TGA, it is trivially easy to write. Example in C# for grayscale version, a single page of code: https://github.com/Const-me/Vrmac/blob/1.2/VrmacInterop/Util...

BMP is more complicated, unfortunately. The header structure is more complex. And then there’s a requirement for rows to be 4-bytes aligned, might need to insert padding bytes between the rows.

Re: Image file formats that didn’t make it

#67
post #34

JPEG2000 is a big one that seems to be missing. It is used in medical imaging or something, because laws? But its visual quality is worse than old JPEG, despite a PSNR advantage. Apparently, compression researchers used to think that people care about PSNR.

I've always been curious about the distinction between JPEG and JPEG2000. From what I can find online, everyone says that the visual quality is better than JPEG, it just flopped due to slow adoption. Could you elaborate on your claim that it's worse?

My understanding is that JPEG2000 never really demonstrated, in experiment, that it was better than JPEG at the types of images and use cases which JPEG was already designed for (photographic images, lossy compression). This use case is such a dominant use case for the web. If you wanted similar quality levels for JPEG and JPEG2000, you often got similar file sizes. I could dig up some of the tests, but the basic gist of it is that at lower file sizes, JPEG2000 would get blurry and JPEG would get that funky blocky noise it gets.

This is the result of actual experiments with human subjects judging image quality.

I haven't really heard claims that JPEG2000 is better, actually. I remember people saying that it was "supposed" to be better, but not by people who dug into it and made comparisons with human eyeballs.

There were some images that would appear visibly better with JPEG2000, like photographs with those beautiful fields of defocused color. JPEG2000 captured those fields of color with all the smoothness they originally had.

Re: Image file formats that didn’t make it

#68

Earlier quoted context omitted.

You can write an uncompressed PNG IIRC.

Sort of but not really. You can write out PNG files with deflate blocks that aren't compressed, so in that sense they are uncompressed PNG files, but all of the complexity of supporting compression is still there in the data format in a way that is not fully avoidable even if you don't actually compress the data. BMPs on the other hand are simple to write, only a very small portion of the header data is required and…

BMP is quite complex and poorly documented (it's a bunch of random Microsoft structs and #defines), more so than PNG.

BMP has compression too (RLE and Huffman). PNG is simpler here since you can just drop a DEFLATE library straight in.

Images are usually stored in memory as RGBA in scanline order. You can dump this representation straight to a PNG file (edit: this is wrong, you can't). BMPs are typically written with pixels in packed BGR order, rows going bottom to top. But not always. I think they go top to bottom if you give a negative height, and you can supply masks defining which bits the RGBA come from.

Re: Image file formats that didn’t make it

#69

Earlier quoted context omitted.

That's why some games have uncompressed audio files which made the game size ballooned up. If the game have so much audio on, it would be best to use uncompressed audio as CPU don't have to spend extra resources to decode bunch of audio files at the same time when the games is asking for it.

This is a small pet peeve of mine. Even though PCs have mostly lost dedicated "sound cards" they still have dedicated hardware for sound decompression in their SoC packages. The big reason I think games often think they need so much uncompressed audio has not as much to do with hardware support as much as it is that games and general consumers "forked" on different compression paths in audio. Most consumer audio is M…

> ... they still have dedicated hardware for sound decompression in their SoC packages

Do they?

Even if they do, it's typically useless for an application like a game, because the game will need to filter and/or mix that audio in ways that the hardware probably can't handle on its own. (Sure, maybe your hardware can decode one MP3 at a time, but can it decode two dozen MP3s at once, apply a bunch of environmental filters to them, and mix them down to a single stereo output? Probably not.)

Post reply on HN