André andre.roberge at
Wed Oct 15 03:31:26 CEST 2008

On Oct 14, 1:56 pm, bearophileH... at wrote:
> André:
> > Ok, the following is my first attempt at implementing this idea.
> I suggest you to change the program you use to encode your images,
> because it's 1000 bytes, while with my program the same 256 colors
> image needs just 278 bytes:
> RHBhsgAXs4zofXPzTZujlMayRjdmaMZDjXvtEy9FFp75zOXI/pX5n6D/lQ
> v1WHnUJarTjGuRxpIxkLHtyIinx4tcy2S694Kjfzn2HDNqYM54H/wB55QF
> (and it contains just 8 colors, so it can be saved as a 4 bit PNG,
> saving even more bytes). Generally I suggest to use as few bits/pixel
> as possible, just 1 if possible.

While I agree that embedded images should be as small as possible,
I believe, should be left entirely to the user.  The code sample I
was just a proof of concept - something people asked for on this list.

> For the encoding/decoding you can use str.encode("base64") and
> str.decode("base64"), you don't need to import modules.
Good suggestion.

> Bye,
> bearophile

A more complete example is now available at


(Of course, now I'll have to include this in Crunchy... ;-)

More information about the Python-list mailing list