Log in

View Full Version : Convert BIFs to GIFs ?



barvaz
01-07-2004, 19:36
Hi all,

What would be the easiest and fastest way to convert a bunch (unit icons, flags, description pictures) of BIF files to GIF without losing transparency and ideally, maybe even set the desired faction color where applicable?

I looked at BifRead but it only outputs to BMP and does one at a time so I'm looking for a shortcut.

If there is no made tool, is there any resource that describes the details of the BIF format (I couldn’t really find anything online) ?

Thanks.

- barvaz

Lord Wolfric
01-08-2004, 03:23
Yeah. What he said.

I'd like to piggyback off barvaz's question and ask for a step-by-step explanation of how to modify the colors, shields, and battle flags of a given faction. I'm not worried about changing units or inventing new buildings or anything like that. I would just like to change colors so a given faction will look cooler to me.

I asked this elsewhere, so sorry for repeating myself.

chris
01-08-2004, 04:10
i would like an answer to this myself, the bif editing prog. really aint much. Even better how about gif to bif?

barvaz
01-11-2004, 11:59
No one knows ? This means that it can't be done easily ?

Is the only option is to use BifRead, convert to bitmap and then manually converting to GIF and setting the transparent color ?

- barvaz

Wellington
01-13-2004, 22:01
Quote[/b] (barvaz @ Jan. 11 2004,04:59)]No one knows ? This means that it can't be done easily ?
barvaz,

I think you have to back-track a little and consider exactly what you are trying to achieve and why.

Talking about conversions between BIFs and GIFs (with retained transparency) makes no sense. GIFs have no transparency as such.

Some graphics images, such as GIFs and JPGs, are very popular with WWW sites and applications. However, such images are compressed quite well and therefore 'lend' themselves to internet downloads because of the high compression ratios they offer in respect of the original images.

Other graphics images, such as BMPs/TGAs/LBMs/BIFs/BUFs are far less suitable for usage in downloads (ie - WWW applications) as they offer formats suitable for computer programs to analyse and utilise.

That's why you rarely (ever?) see GIFs or JPGs in computer games that also rely on the colours contained in such images, or see BMP/TGA/LBM images on web sites.

The type of image ALWAYS determines how it is used.

MTW and STW both use images that are full colour 24-bit (TGA's) and these may often be converted to GIF/JPG format and visa-versa. Such TGA images are not "colour dependant" in MTW terms. Such TGA formats are used in MTW for images that the engine does not need to "analyse" in any way. FOr example, campaign maps, glory goal images, personality portraits, and so on.

Other images that MTW/STW utilise (LBMs/BIFs/BUFs) are paletted images (maximum 256 colous) that serve a specific purpose in either of 2 respects -

1) the position of a colour (0 to 255) in the palette serves to indicate something (to the game engine)
2) the actual colour (RGB), anywhere in the palette, serves to indicate something (to the game engine)

Any transparency in such images may be implied by either 1 or more specific colours (as in the BIF frames for units), or the actual palette position (as in LBMs for model textures).

Therefore, talking about preserving transparency when converting images from one format (designed and utilised for game engines) to another format (designed and utilised for maximum compression and fast downloads from web sites) is a misnomer. BIF and GIF images are as different as chalk and cheese, and connot be successfully interchanged whilst preserving the characteristics of the original image.

You wanted to know the details of a BIF format - try this thread http://www.totalwar.org/cgi-bin....lington (http://www.totalwar.org/cgi-bin/forum/ikonboard.cgi?act=ST;f=5;t=11293;hl=wellington)

If you can give an idea of what you wish to achieve there will undoubtedly be solutions available to circumvent such incompatabilties between graphics image formats.

Welly

barvaz
01-13-2004, 23:59
Wellington,

Many thanks for taking the time to answer in such detail.


I am well aware of the differences between various image formats and their uses. I agree on the point about JPEG usage in games but I think GIF is not being used for legal reasons (licensing, royalties and other such nonsense).

I really don’t understand why you say BIF to GIF conversion doesn’t make any sense, it makes perfect sense if you want to display game icons, flags and unit info pictures in a web page. GIF seems like a natural choice since from my first impression (and the information in your answers point there as well) BIF and GIF formats look very similar. Both use indexed color palettes, both are limited to 256 colors, both have one color designated as transparent (both can even store frames, used for animation in GIFs).

Why “preserving transparency” is a misnomer ? If two formats have the ability to define an area in an image to be transparent, even if the exact method to express this definition differs (which may or not be the case for BIF vs GIF), doing so is just a matter of finding the formulas to convert the definitions from one “language” to another.

Anyway, what I was looking for is the most quick and easy way to convert in-game BIFs to GIFs using already made tool(s). If such tools are not available I will write them myself eventually. That is why I was asking for pointers on the BIF format. The information you provided in this and the linked posts are a very good start for me.

Do you know if BIF is a propriety format or is it being used in other applications ? Is there anywhere an exact technical description of the format ? Source code maybe ?

As for your question why I am interested in all this, my current fun project is to finish a web application I started long time ago that will let users view all game data in nice sortable and easily manageable tables. Maybe one day I will even finish it http://www.totalwar.org/forum/non-cgi/emoticons/gc-wall.gif

Thanks again.

- barvaz