On Oct 14, 11:56 am, [EMAIL PROTECTED] 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: > > iVBORw0KGgoAAAANSUhEUgAAABYAAAAeCAMAAAAfOR5kAAAABGdBTUEAAL > GPC/xhBQAAAAd0SU1FB9gKDhAtOfvfKucAAAAYUExURf///wAAADMzM1tb > W4CAgKSkpMDAwP8AAEQE8ZoAAAABdFJOUwBA5thmAAAACXBIWXMAAA50AA > AOdAFrJLPWAAAAdElEQVQoU63Q0QrAIAgFUO/U9f9/vIxqpRIMdqOXQ6lF > RHBhsgAXs4zofXPzTZujlMayRjdmaMZDjXvtEy9FFp75zOXI/pX5n6D/lQ > v1WHnUJarTjGuRxpIxkLHtyIinx4tcy2S694Kjfzn2HDNqYM54H/wB55QF > O+Mp5mAAAAAASUVORK5CYII= > > (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. > For the encoding/decoding you can use str.encode("base64") and > str.decode("base64"), you don't need to import modules. > > Bye, > bearophile
+.5 docpicture. For encoding, it might read in from a file, try multiple different formats, including SVG, and uses whichever one is shortest. It might be nice, if they take too many lines, to store them at the end of the file, and make sure docpicture looks for them there. It could be more hassle (maybe less, actually), to store them as attributes of the objects they're accompanying, and still locate them at the bottom-- sort of like an appendix or something. def foo(): code code def bar(): '''doc str''' code code foo.__docpic__= ''' hexhexhex hexhexhex''' bar.__docpic__= ''' hexhexhex''' -- http://mail.python.org/mailman/listinfo/python-list