Archived

This topic is now archived and is closed to further replies.

image file loaders.

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

Depends on what API you are using - for OGL then you can use DevIL or Corona, SDL has SDL_image. Don''t know any image libraries for DirectX so you might want to do sme research if that''s what you are using

Share this post


Link to post
Share on other sites
quote:
Original post by Spudder
Depends on what API you are using - for OGL then you can use DevIL or Corona, SDL has SDL_image. Don''t know any image libraries for DirectX so you might want to do sme research if that''s what you are using


You should also be able to use the libraries you mentioned with locked Direct3D/DirectDraw textures/surfaces too. Another library is FreeImage.

DirectX comes with the D3DX library which supports .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga.

Additionally under Windows you can use OLE to take advantage of the formats supported by programs such as Internet Explorer.


quote:
Original post by dynamicman
Another question would be, what image file formats are the most popular and why?


JPEG - small file size due to lossy compression. Originally intended for digitised photographs (Joint Photographic Experts Group). The majority of photographs you''ll find on the internet are in JPEG (JFIF) format.

TGA - easy to encode and decode; supports a variety of pixel formats including palettised; supports simple RLE (run length encoding) compression which can be fairly good for images created on a computer (i.e. big areas of the same colour); contains an alpha channel so can be used for transparency/chromakey effects. Originally the format from the TrueVision Targa platform (TGA = TarGA). Very commonly used for textures in games.

PNG - a replacement for the Compuserve GIF (Graphics Interchange File) format which has none of the patent/licensing problems. Intended to be THE format for exchanging non-photographic images over the internet (PNG=Portable Network Graphics). It supports multiple bit depths and things like alpha channels and gamma values as well as being ZLIB compressed (lossless). Usually pretty good compression on non-photographic images due to the (lossless) filters it uses on the image before compression.


There are plenty of other graphics file formats out there - many are more popular on some platforms than they are on others, and more suitable for some tasks than others. Check out www.wotsit.org for a pretty exhaustive list of file formats in use.

--
Simon O''Connor
3D Game Programmer &
Microsoft DirectX MVP

Share this post


Link to post
Share on other sites
Thanks for that S1CA, haven''t used DX that much. If you after details of image formats the best place to go is www.wotsit.org - they have details on thousands of different file formats or alternatively libraries like DevIL, Corona and SDL_image are open source so you could look at the way they do things and modify it for your application

Share this post


Link to post
Share on other sites