problem displaying some images with wx.StaticBitmap / GenStaticBitmap

I am having problems displaying certain images with both
wx.StaticBitmap and wx.GenStaticBitmap. The images simply
don't display despite they are loaded just fine from the
file. It doesn't depend on the file type - say, one .png
displays OK while another one does not with the very same
wxPython code.

I am guessing there must be subtle differences with
transparency, certain image format options, etc but my
Google Fu wasn't strong enough to find relevant threads -
can anyone point me in the right direction ?

Thanks,
Karsten

···

--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

Please make a runnable, small as possible, sample application that demonstrates the problem, attach it to your mail, and let us know the platform and wx version. MakingSampleApps - wxPyWiki

···

On 7/21/11 1:02 PM, Karsten Hilbert wrote:

I am having problems displaying certain images with both
wx.StaticBitmap and wx.GenStaticBitmap. The images simply
don't display despite they are loaded just fine from the
file. It doesn't depend on the file type - say, one .png
displays OK while another one does not with the very same
wxPython code.

I am guessing there must be subtle differences with
transparency, certain image format options, etc but my
Google Fu wasn't strong enough to find relevant threads -
can anyone point me in the right direction ?

--
Robin Dunn
Software Craftsman

Why did I expect this answer ? :slight_smile:

Anyway, I'm trying, currently.

I do notice that the problematic images show fine in the
ImageFromStream example of the wxPython 2.8.11 demo.

It does show in the ImageBrowser of the demo.

Modifying the ImageFromStream example to use GenStaticBitmap
(which is what GNUmed uses) displays the images fine, too.

So it, indeed, seems to be a function of how GNUmed uses the
image/bitmap classes.

For what it is worth I am attaching the modified
ImageFromStream.py from the demo plus two images, one of
which works in GNUmed while the other does not.

Maybe someone can spot a difference with the image files
right away ?

Karsten

ImageFromStream.py (1.58 KB)

···

On Thu, Jul 21, 2011 at 02:43:31PM -0700, Robin Dunn wrote:

On 7/21/11 1:02 PM, Karsten Hilbert wrote:
>I am having problems displaying certain images with both
>wx.StaticBitmap and wx.GenStaticBitmap. The images simply
>don't display despite they are loaded just fine from the
>file. It doesn't depend on the file type - say, one .png
>displays OK while another one does not with the very same
>wxPython code.
>
>I am guessing there must be subtle differences with
>transparency, certain image format options, etc but my
>Google Fu wasn't strong enough to find relevant threads -
>can anyone point me in the right direction ?

Please make a runnable, small as possible, sample application that
demonstrates the problem, attach it to your mail, and let us know the
platform and wx version. MakingSampleApps - wxPyWiki

--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

As usual, this helped :slight_smile:

For the record:

We do a rescaling of the wx.Image() before turning it into a
wx.Bitmap() and showing it. The height to rescale to is
pre-defined and the width is calculated:

  rescaled_width = (current_width / current_height) * rescaled_height

This, of course, will rescale to a width of 0 if the current
width is less than the current height... (look up the /
operator behaviour on integers). No wonder I can't see the
images :wink:

Karsten

···

On Fri, Jul 22, 2011 at 11:30:42AM +0200, Karsten Hilbert wrote:

> >I am having problems displaying certain images with both
> >wx.StaticBitmap and wx.GenStaticBitmap. The images simply
> >don't display despite they are loaded just fine from the
> >file. It doesn't depend on the file type - say, one .png
> >displays OK while another one does not with the very same
> >wxPython code.
> >
> >I am guessing there must be subtle differences with
> >transparency, certain image format options, etc but my
> >Google Fu wasn't strong enough to find relevant threads -
> >can anyone point me in the right direction ?
>
> Please make a runnable, small as possible, sample application that
> demonstrates the problem, attach it to your mail, and let us know the
> platform and wx version. MakingSampleApps - wxPyWiki

--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346