[OLPC-Games] Image resizing?

Kent Quirk kent_quirk at cognitoy.com
Thu Sep 6 00:46:50 EDT 2007


So the reason I resist PIL is just its size. The XO has very little 
space to mess with as it is -- adding a library like PIL, while handy, 
isn't strictly necessary, and we need to make sure that anything not 
strictly necessary is omitted.

    Kent



Roberto Fagá wrote:
> 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
>>     


-- 
------------------------------------------------------------
Kent Quirk           I'm making a game about global warming.
Game Architect                        Track the progress at:
CogniToy                http://www.cognitoy.com/meltingpoint



More information about the Games mailing list