Image in a module question

Pete Shinners shredwheat at attbi.com
Thu Mar 28 12:11:04 EST 2002


Christopher wrote:
> A while back, I remember somebody mentioning a way to store image data
> in a Python module.  This is something I think I could really use (I
> want to incorporate an image into an frozen exe that I am writing for
> my coworkers).  I would like to keep the installation nice and neat
> (--onefile) and I figure the easiest way is to store the image in a
> module, import it, then use the string (I am assuming this is what you
> would get from the module, I can't remember what the post sais) e.g.,

i've got a working tool that does this. although it uses pygame to load 
and display the image (could probably be switched to PIL without too 
much effort)

http://www.pygame.org/pcr/submissions/01142002b.html

this will create a .PY file with an image in it. the PY file even has a 
small "bootstrap" code so running the script will display the image. it 
properly handles things like palettes and colorkeys




More information about the Python-list mailing list