[Image-SIG] Re: Pure Python JPEG parser

David Fraser davidf at sjsoft.com
Wed Nov 24 15:06:19 CET 2004


Fredrik Lundh wrote:

>David Fraser wrote:
>  
>
>>I couldn't resist it... I found a C++ simple (and imperfect) JPEG parser
>>(http://www.codeproject.com/bitmap/TonyJpegLib.asp) and converted it by
>>hand to pure Python ...
>>    
>>
>you're nine years late:
>
>http://groups.google.com/groups?selm=9512171552.AA03787%40kalle.image.ivab.se
>
>(no, I no longer have the code)
>  
>
Well at least now when somebody searches for the code they can find some 
and decide its too slow :-)
Anyway with Psyco an improvement is possible ; my algorithm is likely 
much worse than yours since yours was only about 250 times slower than 
PIL and mine is possibly 5000 times slower - see below.

>>Here's a table of a brief test, image size and execution time under
>>Standard Python and Psyco running on my Athlon
>>Image Size          |  Standard Python  |  Psyco
>>photo, 2048 x 1536  |  32 minutes       |  46 seconds
>>cartoon, 604 x 446  |  16 seconds       |  4 seconds
>>    
>>
>hey, the PIL column is missing...
>  
>
That's because its invisible because it was too fast :-), but for reference

Image Size          |  Standard Python  |  Psyco        | PIL
photo, 2048 x 1536  |  32 minutes       |  46 seconds   | 0.37 sesconds
cartoon, 604 x 446  |  16 seconds       |  4 seconds    | 0.071 seconds

I couldn't find any recent discussion on including PIL in the standard library but I think it would be a great idea

David


More information about the Image-SIG mailing list