View Full Version : BITMAP or TGA??????????
08-18-2001, 01:55 AM
I've seen many examples on This site of eg. heightmaps saved as .bmp and others as .tga which then were used in demos. To be honest I don't know really much about tga and therefore I would like to ask you guys for an explanation! What is the diffenrence between .bmp & .tga. The advantages & disadvantages of using both? (I guess .bmp eats more memory?)
What is the best format to use for heightmaps? maybe some other then these 2 above?
[This message has been edited by robert_s (edited 08-18-2001).]
TGA can store and alpha channel, BMP can't. TGA supports compressed data, BMP don't Uncompressed TGA and BMP are of about the same filesize. The only difference is a few bytes in the header, which tells you how the file is stored. The actual data is raw data. Compressed TGA's can be smaller, but does't have to. Due to the type of compression used, they can actually become larger. Both BMP and uncompressed TGA are easy to load. Compressed is a bit more work.
The best format for a heightmap is the format you can read. A JPG-image is useless if you can't read it.
I think PNG files are the best for any kind of images. They support alpha, the have very nice compression ratio, not too difficult to load, lossless compression (JPG has destructive compression).
Bob, you forgot
BMP are windoze crap.
I wrote a very simple function to load a uncompressed TGA. I don't know how bmps are, but it was really easy. It took me just a couple of days, while doing many other non-gl-related things.
TGA all the way!
How many professionals uses bmps?
08-18-2001, 09:24 AM
ok Guys! Thx!!
I'll go for TGA as this one will work on linux as well!
thanks for your replies!
256 color bitmaps can be RLE-compressed just like a targa.
I forgot to tell you where to find file format specifications.
It took me three days to find it ^_^!
PLZ tell me if you find the jpg specs...
Obli, I don't know if that windoze crap was a joke or something like that. If it wasn't, I have to say I don't really agree on that one. Sure, they might be crap, but not windoze crap. Nothing stops you from using them under Linux, Solaris, MacOS, BeOS, <insertyourfavoriteoshere>, and so on. And for the crap thing. If BMPs are crap, then so are uncompressed TGAs. The only difference is the header http://www.opengl.org/discussion_boards/ubb/smile.gif
And j, now when you say it, sure there are RLE-compressed BMPs aswell. Sorry 'bout that one. By the way, compressed TGAs uses RLE-encoding aswell.
But I agree that TGAs are more usefull that BMPs. They can handle the important alpha channel!
Obli, I wouldn'r recoment you do the JPG loading yourself. Get a third party library instead. I can recomend Inter JPEG library, try search for it somewhere at cedar.intel.com (http://cedar.intel.com) .
Specifications for a whole bunch of fileformats can be found at www.wotsit.org (http://www.wotsit.org)
08-19-2001, 05:11 AM
thank you very much 4 ur advices guys!
I'll check your links!
I am sure these will help a lot!! http://www.opengl.org/discussion_boards/ubb/smile.gif
Obli - if I found some stuff about jpg's then I'll let you know straight away! http://www.opengl.org/discussion_boards/ubb/wink.gif
I simply have to admit I was wrong.
I always heard of .bmps in windows... well I know something new. Thanks, especially for those useful links!
[This message has been edited by Obli (edited 08-19-2001).]
Well, BMPs originates from Windows, but they are just files ending with ".bmp". This file can be moved across any platform as you want, it's just a matter of understanding what each byte in the file means. So I DO understand what you meant by "windoze crap" http://www.opengl.org/discussion_boards/ubb/tongue.gif
hmmm, some people don't know much about BMP format:
it can also store alpha channel, though I don't know any programs that support it. BMP header is quite complicated if you don't use windows API. (The ones who don't believe: just look it up in the MSDN).
And about TGA: actually very easy to read, supports RLE compression for arbitary color depth images. The specification supports more sophisticated compression methods.
08-19-2001, 12:47 PM
for full docs on the TGA file format
go to www.wotsit.org (http://www.wotsit.org) search for TGA they have a file there that has the entire format...
it may be easier to use a file format that has a library written for it that you can use to read the image. i like .png files (especially for a height field, cause it can hold 16 bit grayscale images, im pretty sure bmp cant, and i dont know about tga). try www.libpng.org (http://www.libpng.org) itll have a library thatll make it a lot easier to read the file, than manually writting code that does it. libraries exist for many other image file formats as well, look for them on google or something...
At the minute I like TGAs over BMPs.
I'm not quite sure why, but the .bmp extension offends me for some reason.
If you can find a paint package (GIMP) that makes 32-bit TGA images (RGBA) then you're laughing because they are pretty easy to load, well documented and a breeze to use.
Not that Bitmaps don't have that, but they do have an offensive extension.
Rob The Bloke
08-21-2001, 11:30 AM
tga's and bmp's are pretty much the same. They are both very simple file formats. The main difference is that unlike the fixed 18byte header of the tga, the bmp can have a number of header sizes (os2, win32..). However, if you ever find one that isn't a win32 version I'd be surprised.
The main problem that people tend to disregard with bmp files is that they have to be aligned to a word boundary. (not an issue with glTexture sizes, but for anything else there may be a problem)
bmp's support 32bit images, but no one supports 32bit bmp's if that makes sense.
I use pcx these days....a very simple compression algorithm.
08-21-2001, 12:14 PM
I have code that reads and writes bitmaps on any platform, windows or not. I like bmp's cause they are a very simple way to get started going from picture to texture. Windows sucks, but not because of bmp's http://www.opengl.org/discussion_boards/ubb/smile.gif
Some day I want to see which is faster for loaded my satelite photo textures: JPG (slower because of having to uncompress, but much smaller on disk, so less time doing disk io), or bmps (no decompression, but large on file). I imagine it depends on the size. Mine are all 256x256 color index.
[This message has been edited by nickels (edited 08-21-2001).]
08-22-2001, 06:32 PM
Originally posted by Rob The Bloke:
....the bmp can have a number of header sizes (os2, win32..). However, if you ever find one that isn't a win32 version I'd be surprised.
I can make a simple OS2 one just for you...
Rob The Bloke
08-24-2001, 05:42 PM
Originally posted by Platinum:
I can make a simple OS2 one just for you...
So could I, I don't really want to though ... http://www.opengl.org/discussion_boards/ubb/smile.gif
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.