I was fiddling with a sprite rip from WarZard/Red Earth (looks like an excellent game, shame on Capcom for never promoting it in the US!) in my gif compiler when it came to me how important color optimization can be to making/editing sprites. Now, I've had a few people ask me before why they should use gif compiler programs (like Gif Movie Gear or Animation Shop) to crop and edit transparencies, when these kind of features are already in most paint programs (like PaintShop Pro). I always just said that I used a gif compiler for these mainly because I'm used to using them for animations, and I always thought it was a good habit to practice. But now after reviewing optimization- I see another, more important reason why I use gif compilers.

Now, just to be clear, when I say optimiztion, I mean decreasing the filesize of an image/animation by whatever means possible. Usually, this is done several ways:
1. Reduce the size of the image, in pixels
2. Reduce the size of the color palette (usually, non-sprite images- like jpegs- are at 16 million colors, but by reducing that palette to 256 colors or so can really reduce filesize)
3. Use few/no filters or special effects on the image (like blurring or lensflare), as these can quickly eat up filespace on the palette.
4. For gif animations, there are numerous freatures in gif compilers that can be used to otpimize the gif easily, such as transparency effects and dithers. Deleting frames in gif animations can also free up much filespace.

There may be other methods for optimization, but these are the most common I know of. Take notice of numbers 2 and 4, as these are important ways to optimize specifically for sprites. Now, one can reduce the color palette and edit transparency in a paint program (let's use PSP in this example), but one problem I found with using these features is that the paint program can distort the colors automatically when it goes to save a gif, which you usually have no control over. Ever look at some sprites and notice unwanted/unexpected dots scattered about them? Like this Spiderman edit (sorry JDR, just using it as an example):


You may wonder why this happens. Well, its not completely certain, but my theory is that whenever a paint program, like PSP, goes to save sprites after their transparency has been toggled, it automatically 'dithers' the sprite's palette. What is a 'dither'? you may ask. Dithering is whenever hues from the existing/reduced color palette are diffused as small pixel 'dots' to simulate other hues that used to be in the palette before the dither/optimization. Just to show this effect for clarity, the following a comparison between an unoptimized sprite without dither (on the left) and the same sprite dithered and optimized (on the right)- notice the differences:
http://www.angelfire.com/geek/dogglife583/TrishDitherCompare.html

So how can one prevent this from happening in PSP? Well, that is part of the problem. I don't think it can be helped- sort of like how PSP automatically distorts jpegs to accomodate for having 16 million colors in an image- the process is seemingly unavoidable. This is where gif compilers come into play. Let's say I just found a good quality screen capture of an unemulated game (like SF3 or WarZard) and I want to start to rip a sprite from it:
Credit to the original site I got this from

Now, after opening it in PSP, or whatever paint program, cutting around the sprite to isolate it, edge-preserve smoothening and then shaprening, ect...I wanted to start repainting the sprite to lessen its palette (now at 16 million colors) and to get rid of the noticeabe distortion on the sprite: http://www.angelfire.com/geek/dogglife583/LeoSpriteLarge.html

So, I start the long (very arduous) task of repainting: first reducing the color palette to 256 colors, sizing down the sprite 50% (to get it on more common sprite scale), then use the eydropper to get local hues, paintbruch set to 1 pixel, and the filler tool with a 15 tolerance on occasion, ect... Soon enough (or in my case, much later), I have a somewhat finished retouched sprite. But there is a problem. Unfortunatley, the color pallete is still at a (relatively) large size of 256 colors, and I want to reduce the palette as much as possible and make the background transparent. How should I go about this best? Well, this is where I open my gif compiler (Gif Movie Gear, or GMG for short).
The great aspect to most gif compilers is that their optimization features can be much easier and efficient than the ones in paint programs, and the gif file is only as distorted as you want to make it- no automated, unforseen optimization or distortion you, the uyser, can't control. In GMG at least, I can not only edit transparency and crop, but also use its color optimization feature (which is also in Animation Shop, I believe) to reduce the palette even further- this can be very useful. Since we're starting with a sprite whose palette is 256 colors, an ideal first optimization would be half of that, 128 colors. So, after decreasing it to 128, I find the distortion to be very small and I can safely decrease it to about 90 colors, like so:
http://dogglife315.netfirms.com/LeoSpriteSmall80.gif

Am I done though? I really think the sign of a good sprite editer/painter is that they can make/edit sprites using only as many hues as needed, and try to optimize filesize without losing too much quality- with no wasted or extra hues. Here, I think it'd be ideal if I could get the palette to around 50 hues, if possible. So, I edit out the white/grey parts of the sprite, leaving only the close orange/red hues, and try to optimize further. I'm able to get it to around 50 hues, so when I go back to put the grey/white parts, I only have 72 total hues. But I know I could go much further, so I optimize the sprite again and one last time, and I find I can safely get it to 25 colors(!) without much noticeable distortion. Now this is useful- think about it: I went from an image the was 16 million colors, to a 256 color sprite, all the way down to 25 colors. That's a lot of optimization! And I really could only have done it in my gif compiler. Here, from left to right are the two optimized versions- 72 colors (4.63KB) and 25 colors (3.13KB):


Notice you really can't tell that much of a difference between them. And on on-line forums especially, optimization is important for keeping images small, so they take up as little band width as possible, and without noticeably distorting the images. This is why I think optimization in gif compilers instaed of paint programs is important.
Note- I would not suggest going below 20-30 colors when optimizing, especially if the sprite you are ripping has many different color ranges, as that's when distortion usually becomes apparent. Here, this Leo rip didn't have much color variation, so it is different for every sprite. And I also do not suggest dithering the sprite. The dot pixelation dithering creates is usually too noticeable for low-resolution sprites, and dithering increases filesize a bit.

One last thing I found to be pretty cool was if you reduce the sprite's color palette to only 3-4 hues (counting the transparency as a hue) you get a shadow-like effect:


That sprite is only just above 1KB! Not to gloat, but for a sprite that large in dimensions, that's pretty darn small in filespace. Again, only with a gif compiler could I have done that without worrying about extra distortion.

So there you have it- my thoughts on optimization and why I find gif comiplers useful for more than just throwing gif animations together. I feel its pretty important, as more and more people are trying to manually rip/edit sprites from yet unemulated games.
Hope that was informative in one way or another.

And just for reference, here are a few sites to obtain a good gif compiler:
Gamani.com - For GMG 3.0 trial
Jasc.com - For Animation Shop 2/3 trial
Downlaod.com - For Ulead Gif Animator 5.0 trial
Download.com - For AniMagic 1.22 (freeware)



Site hosted by Angelfire.com: Build your free website today!