Image in a module question
Joonas Paalasmaa
joonas at olen.to
Thu Mar 28 02:37:14 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.,
>
> import MyImageModule
> import Image, ImageTk, StringIO
>
> myImage = MyImageModule.MyImage # Where MyImage is the string
> representing the image
>
> im = Image.open(StringIO.StringIO(myImage))
> # I can now use im to construct my Tkinter label/button/etc.
>
> I did some searches: PIL, image in module, importing images, etc. and
> didn't see the post (it was a lot of pages, i may have just missed
> it). If somebody remembers the post, could you point me to it (just
> the date would be a huge help). Thanks a bunch,
Fredrik Lundh explains exactly what you need to do in an ancient
newsgroup article at
http://groups.google.com/groups?selm=9705101637.AA16871%40arnold.image.ivab.se
More information about the Python-list
mailing list