Jump to content
  • Advertisement
Sign in to follow this  
openglJunkie

Best Image File Format For Games

This topic is 3626 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!