Zooming and panning images

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Zooming and panning images

Virgil Stokes
I have attached a python script that I believe would be useful as a template for
the manipulation of images with wxPython and PIL. It would be interesting to
know if the use of PIL can be eliminated; i.e. wxPython imported, but not Image
from PIL. Any feedback (positive or negative) on this snippet would be welcomed.

Have fun!:-)

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

ImageZoomScaleExampleC.py (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Zooming and panning images

Vlastimil Brom
2014-03-05 12:57 GMT+01:00 Virgil Stokes <[hidden email]>:

> I have attached a python script that I believe would be useful as a template
> for the manipulation of images with wxPython and PIL. It would be
> interesting to know if the use of PIL can be eliminated; i.e. wxPython
> imported, but not Image from PIL. Any feedback (positive or negative) on
> this snippet would be welcomed.
>
> Have fun!:-)
>
> --
>
Hi,
thanks for the sample code;
as for the avoiding of the PIL dependence, you may try, whether
wx.Image would satisfy your needs:
http://www.wxpython.org/docs/api/wx.Image-class.html

I used it for a simple image viewer and it was rather straigtforward,
but you have to check it with respect to your needs - it is clearly
rather lightweight compared to pil.

hth,
  vbr

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Zooming and panning images

Chris Barker - NOAA Federal
In reply to this post by Virgil Stokes
On Wed, Mar 5, 2014 at 3:57 AM, Virgil Stokes <[hidden email]> wrote:
I have attached a python script that I believe would be useful as a template for the manipulation of images with wxPython and PIL. It would be interesting to know if the use of PIL can be eliminated; i.e. wxPython imported, but not Image from PIL.

Sure -- at least at a glance, wx.Image has everything you need.

-Chris

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[hidden email]

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Zooming and panning images

Metallicow-2
In reply to this post by Virgil Stokes


On Wednesday, March 5, 2014 5:57:54 AM UTC-6, Birdy wrote:
I have attached a python script that I believe would be useful as a template for
the manipulation of images with wxPython and PIL. It would be interesting to
know if the use of PIL can be eliminated; i.e. wxPython imported, but not Image
from PIL. Any feedback (positive or negative) on this snippet would be welcomed.

Have fun!:-)

I have written a couple image viewer implementations myself.
I looked at it, and yes, after a few mods I got it to fire with wxPython only, so yes, PIL isn't needed here.
PIL is nice and performs better for image stuff like this, so the best thing for you to do
would be to try and import PIL at the start and depending on if it imported, then use a global to regulate how what methods to use.

The code be optimized quite a bit in certain places I see. Also, the Image Window should be it's own class so that it is easily reusable and not tied into the frame class.
The newer versions of wxPython wx.Image can handle everything I see here.
PIL would only be useful for slight performance gains and maybe oddball image operations if you want to show certain image effects.

The Image window would perform better as a buffer bitmap also, and just have the Paint function call the buffer with a BufferedPaintDC and empty EraseBackground def.

...anyway, that's just my 2-cents...

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.