When wx.Image hits a truly corrupt JPEG it brings up a modal dialog box
that says:
JPEG: Couldn't load - file is probably corrupt
And the console says:
Corrupt JPEG data: premature end of data segment
This is truly horrible UI for my application. I just want the
wx.Image(filename) to do something programmatic like:
- return None
- return an Image that is not Ok()
- raise an exception
After all, I never asked it to talk directly to my user!
I didn't find anything searching the mailing lists, wiki or docs. Has
anyone run into this? Worked around it?
On a side note, wx.Image's rescale() results look pretty crummy compared
to other software. Maybe I should use drop wx.Image and use PIL...
On a side note, wx.Image's rescale() results look pretty crummy compared
to other software. Maybe I should use drop wx.Image and use PIL...
Yes, if memory won't be an issue and it isn't too slow, keeping the original
around, a scaled image in PIL and the wxImage/wxBitmap probably makes sense
for better quality.
On a related note, I'm not sure what your image sources are, so you might
also want to use wxImageFromSteam to just use data in memory to avoid
writing images to disk for normal wxImage or wxBitmap init. Now for a fun
example
When wx.Image hits a truly corrupt JPEG it brings up a modal dialog box that says:
JPEG: Couldn't load - file is probably corrupt
This comes from a wxLogError call, which you are able to control by setting a new log target. See the docs (and demo in Main.py) about wxLog.
And the console says:
Corrupt JPEG data: premature end of data segment
This comes from the JPEG library itself.
On a side note, wx.Image's rescale() results look pretty crummy compared to other software. Maybe I should use drop wx.Image and use PIL...
Yep, wxImage is designed to be plain and simple but fast. Converting to/from PIL images is the way to go if you want quality. (That may be changing in wxWindows 2.5 though...)
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!