[OLPC-Games] Image resizing?

Roberto Fagá robertofaga at gmail.com
Wed Sep 5 20:31:49 EDT 2007


Thanks Luke, I don't know why I didn't think on using the original
image. Resizing the original produces a good result, not filtered but
its looks fine.
About the tests, check for this:

http://pera.ifsc.usp.br/faga/ppr.py

change the images path and you can check, pygame's scale method is a
bit slower, but nothing terrible, it's usable for games as converting
from PIL to Pygame is slower than using only pygame's scale method.

Oh, and rotozoom is too slower than scale, so use rotozoom only when
you need to rotate.

Here are the times I got as my example image, all operations doing 1000 times:

############
PyGame:
        Time to load a picture: 41.1937s

PIL:
        Time to load a picture: 0.4902s
PyGame:
        Time to scale: 14.1414s
        Time to rotozoom: 59.5741s

PIL:
        Time to resize: 7.2797s
        Time to resize converting to pygame surface: 20.2374s


for 100 times:
PyGame:
        Time to load a picture: 3.5198s

PIL:
        Time to load a picture: 0.0408s
PyGame:
        Time to scale: 0.9184s
        Time to rotozoom: 5.0856s

PIL:
        Time to resize: 0.7040s
        Time to resize converting to pygame surface: 1.8503s


Roberto Fagá

On 9/5/07, Luke Paireepinart <rabidpoobear at gmail.com> wrote:
> Roberto Fagá wrote:
> > hey Kent
> >
> > but why not add PIL to XO? I'm using PIL for this with better
> > performance, and I think this is very useful to other applications
> > too.
> >
> > the rotosize feature is too worst if you resize the image many times,
> >
> You resize/rotate from a source image every time, so you keep a separate
> copy of the original image, and
> don't modify it ever.
> That minimizes distortions when resizing/rotating.
> > and is slower than using PIL.
> I don't know that that's true.  do you have any tests for this?
> -Luke
> _______________________________________________
> Games mailing list
> Games at lists.laptop.org
> http://lists.laptop.org/listinfo/games
>


More information about the Games mailing list