Best Image File Format For Games

Started by
6 comments, last by dpadam450 15 years, 3 months ago
What image file format would you suggest to be the best for textures (in general) and 2D sprites. I've done some research and it's between TGA (which was used in many games) and PNG and my choice GIF just because wikipedia had an article on the file format and because it supports animation/transparency.
Advertisement
PNG also supports transparency including alpha values which allows you to blend your image with its background.

Depending on your need for this and on the fact that GIF does not support more than 256 colors you take your pick.

Personally I never cared for the GIF animation as it has always been too restricted for my applications.

Concerning file formats: although it is a nice exercise to write a file reader/writer for image formats, you'll soon find out that it's better and faster to use a library that is ready to use.
I would never recomend GIF I think it is still propitary and also doesn't support alpha channel also the animation is so uncontrollable and unflexible. Use PNG it's a really good format with a XML for animation frames. Also there is APNG for animated PNG haven't tried it but it should work also. PNG:s can be compressed with OptiPNG or PNGCrush which makes them a lot smaller.
TGA is also nice but it doesn't compress as well as PNG.
You can always use more than one format. Lossy compression for image data and separate alpha mask (if you need alpha, black and white file, lossy or lossless compression -- your choice) is often the best choice.
Personally, I'd go for DDS, probably compressed using zlib or something similar. Libraries exist to load/parse DDS files, even for non-D3D apis, and there are a ton of free tools available to work with them.
Thank you. I'll stick with TGA. PNG seemed too complicated for game development and had way too much excess data and other stuff just to read the file -- even to include an external lib it seemed like overkill.

[Edited by - openglJunkie on January 6, 2009 8:08:55 AM]
Just being curious: how are you going to do transparency with TGA?

Tip: some painting tools do not set the header(s) correctly the images might turn up flipped on the x axis. Also: color tables and RLE might give you some troubles too.

Read this
JPG is good. TGA is uncompressed but supports an alpha channel. DDS probably wont work for pixel art since pixel art is usually very contrasted.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

This topic is closed to new replies.

Advertisement