JPGs as backgrounds

Started by antineff, Mon 20/02/2006 10:25:49

Previous topic - Next topic

antineff

Hi,

I didn't find an answer to that technical question, maybe I didn't see the forest because of all the trees...

Why is it not possible to import JPGs as backgrounds? That would really help to keep games small and downloadable.

I started a game with 640x480 Photographs as backgrounds and I guess when I finished it will be about 25 Megs big. With JPGs it might be only 3 Megs  in total.
coming soon (or later, sorry!)

Elliott Hird

AGS compresses backgrounds with its own type, regardless of the original, so - import BMPs or PNGs since they'll be compressed anyway. JPG will be compressed too, but since the quality is bad originally it'll be the worst of both worlds.

Gilbert

Well, someone beated me to it but I'll post anyway.

This question had been asked thousands of times already.
Do a forum search, and you should be able to find the answer, one example is this.

I think I may add this to the BFAQ now, due to its popularity.

SSH

AGS games tend to compress quite a lot when you ZIP or RAR them, too.
12

Gilbert

Anyway, added to BFAQ, hope it helps.

antineff

#5
Wow, thanks! You are so fast! I only had a phonecall after posting and got four answers by now. I really love you, guys!

@Gilbot: Of course I searched the forums and of course I got thousands of Threads, but no answer to my question on the first three pages. Not even a hint. So it's great having this question in a FAQ instead of reading 3000 threads. Thank you.

But, and I am very sorry for this, the compression AGS provides is not as good as it would be, if I could use JPGs. To understand my doubts, I'll give you some numbers. I did the compression of the pics all with IrfanView and the game-zipping with the build in WinXP routines:

bg.pcx (original)Ã,  Ã, -Ã,  Ã, 986 kbÃ,  Ã,  Ã,  Ã,  Ã,  (100%)
bg.pngÃ,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, -Ã,  Ã, 661 kbÃ,  Ã,  Ã,  Ã,  Ã,  (67%)
bg.jpgÃ,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  -Ã,  Ã,  Ã, 92 kb (!!!)Ã,  Ã, (9 %) (!!!!!)

Compressed Backup of my game workfilesÃ,  Ã, -Ã,  Ã, 9675 kbÃ,  Ã, (100%)
Compressed Backup of the compiled gameÃ,  Ã, -Ã,  Ã, 5379 kbÃ,  Ã, (56%)

So, this is all very nice, what you are saying but obviously not as nice as it could be. And it is not an answer to my question, WHY it is NOT POSSIBLE to import JPGs just like the other formats.

Thanks in advance for some more satisfying attempts.

BTW, I forgot something: @Elliott Hird: The quality of JPGs with Photographs is really good and preferable to all other formats if you want to save space!
coming soon (or later, sorry!)

Gilbert

Quote from: antineff on Mon 20/02/2006 11:22:26
And it is not an answer to my question, WHY it is NOT POSSIBLE to import JPGs just like the other formats.

It's been answered already, because backgrounds can't be stored using JPEG compression (yet) at the moment, no matter what format the images were originally in, when they're being imported they're re-convert and compressed using ONE lossless scheme by the editor, so importing JPEG files WON'T help in file sizes. As far as I remember, when AGS first supported hi-colour modes, it was possible to import JPEG images as backgrounds, for several versions, but since there's no advantage in doing so (as the backgrounds would be lossily compressed and then losslessly recompressed), to discourage the use of JPEGs, support was removed.

antineff

#7
Oh, thanks. This maybe didn't come out that clear to me before. So "it work's as designed" once more (sigh). I didn't know AGS makes a big spam out of all the data. I thought different components of the game were treated different as they are used differently. What I want to say is, that I don't see any sense in decompressing and recompressing a background rather to just simply storing and displaying it. Maybe I'm not thinking of all the possibilities (or impossibilities) of AGS making that cluster-to-one necessary, but for realising most screen-by-screen-adventures, especially with photorealistic backgrounds, I see more disadvantages than advantages.

Sorry if I seem to be uncomfortable to you, but it IS a problem for me resulting in a 25 Megs game instead of 3 megs.

-------------------

I saw you put the complete answer in the AGS-Wiki. Thanks for that. I'll be patient and maybe someday...
coming soon (or later, sorry!)

scotch

I imagine the reasons for AGS's compression are historical mainly, AGS originally ran in 256 colour mode, this is a mode jpg doesn't support, and png hadn't taken off in those days, also png and jpg are rather a lot slower to decompress than what AGS does use, which is a form of compression similar to gif, so in the old days AGS would be taking in bmp and pcx background images, and storing them in a fast (on old dos computers) and smaller form of compression.
Another reason why jpg would have been decided against was that jpg pretty much ruins things at 320x200 res, at higher resolutions, which we have now, jpg is often a better choice.  If CJ were to change the internal compression format for backgrounds either switching entirely to png (which does reasonably well on all colour depths and sizes, and doesn't mess up pixels), or giving the option of storing in either png, or jpg (which does very well on what it was designed for, photo like images, many colours), would be great.  Backgrounds aren't generally most of the file size of a game btw, even in high res.  Ogg music and animations comprise a larger part of the filesize in games that have them, but more bg compression would still give a significant space saving. On the downside it'd introduce a small amount of lag between rooms on slow computers.

antineff

Thank you very much for the detailed explanation. I believed that it must have to do with something historical. Since I'm not really a programmer anymore (I was it in my former life :) ) I have to use my imagination of how the concept of AGS works. So I see there are things only to be displayed, like backgrounds, sprites, videos, music, sound-effects and speech. And, on the other hand, there is something like "the grid", overlaying the scene, which containst all the controls, positions and timings, the whole logical thing. If those things were kept seperately (like video and sound already is) I believe AGS could be even more flexible than it already is at the moment.

I also belive that this pure form of my imagination might not be optimal, since I guess it is a good thing to compress the sprites and other graphics and text which have a benefit from being compressed with the game. But with backgrounds, which are off any logical use, I don't see a reason why they are not treated like videos and sound (except the historical reasons, of course).

Anyway, thanks for your patience with me, and all I hope is now, that maybe the creator and master of AGS hears the call of a little lost sheep with its humble whishes... ;)
coming soon (or later, sorry!)

xenogia

That and proper hardware acceleration would be nice too.  But this engine still rocks and it has an insane community base behind it.  Wintermute is a good engine, if not a bit more complicated but AGS has the support.

SMF spam blocked by CleanTalk