Pleae help! making a transparant background using SDL_image?/ (Graveyard

thanks a lot david. i didnt know that .jpg was destructive or whatever.
hell, i didnt even know what a destructive format is. thanks for your help.
so .png is the preffered file type for this kind of stuff? is it much
smaller then .bmp? well, i guess ill find out for myself. thanks man!!!_________________________________________________________________
Watch high-quality video with fast playback at MSN Video. Free!
http://click.atdmt.com/AVE/go/onm00200365ave/direct/01/

thanks a lot david. i didnt know that .jpg was destructive or
whatever. hell, i didnt even know what a destructive format is.

Well, if you lower the quality when saving a JPG, you’ll get the
idea. :wink: What’s happening is very similar to what’s happening when
encoding an mp3 file: Information that’s less important (by some
"smart" definition, which is a major part of the trick) is removed to
make the file smaller.

BTW, both mp3 and JPG are based on the idea of converting the data
from the time/space domain (samples/pixels) to the frequency domain,
sorting the resulting spectra somehow, removing the least significant
ones and then storing the remaining data, possibly after compressing
it using some non-destructive method.

Non-destructive formats OTOH, just rely on patterns and stuff in the
data, to store it more efficiently. Every single bit is restored when
you uncompress the data. Examples of formats that use this type of
compression would be ZIP, bzip2 and RAR. These very algorithms, or
very similar algorithms, are also used “inside” various image
formats, such as GIF - and our friend, PNG.

thanks for your help. so .png is the preffered file type for this
kind of stuff?

It’s definitely the most suitable format I know about, that is also
widely available.

Formats like PSD (PhotoShop’s native format) and XCF (GIMP’s native
format) can be really rather nice if you want advanced stuff
(multilayer graphics, animations, easilly configurable blending and
stuff), but those formats are normally uncompressed and perhaps more
seriously, not really standardized. They tend to change between
versions of their respective applications, breaking some or all of
the third-party loaders.

is it much smaller then .bmp?

Yes, especially compared to the usual uncompressed BMP format. (The
RLE format isn’t widely supported, AFAIK.)

well, i guess ill find
out for myself.

Yeah, just try it. File sizes depend on the image data, but generally,
I don’t think you can get better non-destructive compression than
with PNG, except possibly if you put your data in bzip2 or RAR
archives or something. (Those compress some 10-25% better than most
other popular algorithms on most kinds of data.)

If you go destructive, all bets are off, though. There’s basically no
limit to how small files you can have, but it depends entirely on
what kind of graphics you have, and what kind of quality is required.

Note that for simple images with large flat colored areas (as opposed
to gradients and “noise”), nondestructive formats often beat JPG at
both size and quality! That kind of images compress well with typical
nondestructive algorithms, so there’s no point in messing up the data
with algorithms tuned for photo-like images.

thanks man!!!

No problem… :slight_smile:

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Saturday 28 February 2004 01.04, Graveyard Filla wrote:

Just wanted to add that there is one better compression, but that is not
usable yet, because it is under patent. It uses the same burrow wheler
transformation than png and bzip2, but uses arithmetic encoding, which
results in better compression than the traditional ones.

PS. Those who are interested arithmetic coding simply codes the data to
one floating point number (general binary floating point number ie no
fixed length).On Saturday 28 February 2004 13:35, David Olofson wrote:

Yeah, just try it. File sizes depend on the image data, but
generally, I don’t think you can get better non-destructive
compression than with PNG, except possibly if you put your data in
bzip2 or RAR archives or something. (Those compress some 10-25%
better than most other popular algorithms on most kinds of data.)