Board index » delphi » Help with reducing image file size

Help with reducing image file size

Hi!
I am currently working on modifying my sprite engine, and the problem
is the size the sprite file takes.
I save all the sprites in one file, and load them linked listed.
The record of a sprite is:
[1..100,1..100] of byte and
sizex,sizey of integer, to know where is the limit of the sprite
within the 100 on 100.
Till now i saved the empty spaces aswell.
I tried to override it with the following routine:
 for x:=1 to g^.sizex do
  for y:=1 to g^.sizey do
  begin
   blockwrite(f1,g^.screenc[x,y],sizeof(g^.screenc[x,y]),count);

and it saved even a larger file! (For several sprites per file)
I tried also saving it linked listed for every [x,y].. that didn't
work aswell!
If u have a solution please assist!

choKari!

 

Re:Help with reducing image file size


Hi! I have this problem.
I wanted to do a sprite engine, and it worked. The only problem is
that I couldn't keep the sprite file size small enough.
I save all sprites in one file, and load them with a linked list.
The sprite is a record of [1..100,1..100] of bytes, for color(BITMAP)
and sizex, sizey:integer for where the sprite ends in this 100/100
array.
So.
I have lots of wasted space in all of my sprites and i save it in the
file anyways. I tried to do this following routine:

 for x:=1 to g^.sizex do
  for y:=1 to g^.sizey do
  begin
   blockwrite(f1,g^.screenc[x,y],sizeof(g^.screenc[x,y]),count);

And it saved even a bigger file(for many sprites, for one sprite it
was smaller).
I don't understand why.
I also tried saving it with a linked list for every pixel! but that
was impossible!
Any ideas will be more than welcomed!!
Thank you
Roy
choKari!

Re:Help with reducing image file size


In article <218b8d2a.46301...@news.trendline.co.il>, Roy Klein
<k90m...@trendline.co.il> writes

Quote
>I wanted to do a sprite engine, and it worked. The only problem is
>that I couldn't keep the sprite file size small enough.

Tried quadtree compression? Depending on the size and nature of the
image it can work quite well (does for me). Also, not to difficult to
process... recursively... (sorry guys!)

I'll send you some simple demo source if you like. Mail me.

--
Marcus Morris - South Croydon, LONDON, UK (Mar...@ntos.demon.co.uk)
http://www.ntos.demon.co.uk

Other Threads