[wxPython-users] img2py image quality
Robin Dunn
robin at alldunn.com
Wed Nov 7 12:51:58 PST 2007
Steve Senior wrote:
> I am freezing my application with py2exe. The application uses quite a few
> png's. As I don't want to distribute the actual binary pngs I decided to use
> img2py to convert them into an images.py file and extract them from there.
>
> However, when I change my program to use the images from images.py the quality
> of the displayed images has degraded to an unacceptable level.
>
> Is this just an unavoidable consequence of using img2py?
The img2py script simply uses wx.Image to load the file (in any
supported format) and then save it again as a PNG into a memory buffer
that it uses to make the embedded data string. If it is losing quality
(I've never noticed that but it doesn't surprise me) then it is a wx
issue and would probably happen if loaded and resaving to a new file, so
it would be easy to test.
>
> If so, are there any other ways to avoid having to distribute the binary pngs
> with my program?
Since you are starting out with png's then it wouldn't be too hard to
just store them directly in the .py file without going through the load
and save. Or even a simple tweak to the img2py code could make it work
this way by default if it is given a .png. If you want to take that
approach with this and send me a patch I'll add it to the distribution.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list