• Advertisement
Sign in to follow this  

Image file types

This topic is 4678 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

In all of my programs so far, I have used bitmap images. The problem with these is that they don't support an alpha channel and are not compressable. I use the SDL library and was taking a look at SDL_image. This makes it easy to load all kinds of images but I have a few questions (all of the online resources I found were geared toward web pages) 1) PNG images seem to be pretty ideal, but they require dynamic linking to SDL_image.dll, libpng.dll, and zlib.dll. Will this overshadow the benefits of using this file type? 2) I have noticed that most commercial games I have use image formats I've never heard of that paint can't open. Is this just to keep people from ripping or changing their art? Or is it because these formats are optimized for games? 3) What are your guy's favorite image formats for games and why? Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
1) I didn't know PNG needs them. However, even if yes, I see no problem with it.
2) It is because they are their own image formats. You sure would not be happy, if someone would stole images from your game and used them in his own (without giving him permission)...
3) I like my own image format (2).

Share this post


Link to post
Share on other sites
Quote:
Original post by Simian Man
1) PNG images seem to be pretty ideal, but they require dynamic linking to SDL_image.dll, libpng.dll, and zlib.dll. Will this overshadow the benefits of using this file type?

You can download the source for libpng and compile it into a static library if you don't want any DLL files. Here's the source.

Share this post


Link to post
Share on other sites
Or you can distribute dlls with your program to make you sure it will run on each computer.

Share this post


Link to post
Share on other sites
Quote:
Original post by Simian Man
In all of my programs so far, I have used bitmap images. The problem with these is that they don't support an alpha channel


Yes, they do. Your API might ignore the alpha channel, though. If you have a true-colour (32-bit) BMP, then 8 of those bits may be interpreted as alpha (or they may be ignored as padding, according to some setting in the header data).

Quote:
and are not compressable.


Quite the opposite. Basically only "raw" formats such as BMP are compressible; other formats are already compressed. You can't compress something that's already been compressed :)

Of course, dealing with actual compression separately (such as ZIP) is probably more complicated than you'd like.

Quote:
I use the SDL library and was taking a look at SDL_image. This makes it easy to load all kinds of images but I have a few questions (all of the online resources I found were geared toward web pages)

1) PNG images seem to be pretty ideal, but they require dynamic linking to SDL_image.dll, libpng.dll, and zlib.dll. Will this overshadow the benefits of using this file type?


... So what if you have to dynamically link a couple things?

Quote:
2) I have noticed that most commercial games I have use image formats I've never heard of that paint can't open. Is this just to keep people from ripping or changing their art? Or is it because these formats are optimized for games?


There are a few reasons. Sometimes the "format" is just raw data (like a BMP without the header information), with the header information stored elsewhere. (Some compression might be applied over top of that, of course.) You might also see several images (and other resources) packed together into a single file in some proprietary way, or even an image with a "normal" file format that is simply given a different extension to make things a little harder (this is silly though; it is easy to figure these ones out with a little hex-editing).

But generally, yes, it is either a cheap attempt at security or to save a couple bytes on packing things in. There is no real need to "optimize for games"; once an image is loaded, it's all the same data, really.

Quote:
3) What are your guy's favorite image formats for games and why?


I like PNG; it is a well-designed format, providing lossless compression. It is about-equal or superior to GIF in every way I can think of.

Share this post


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

  • Advertisement