Skip to content

ImageInspector is a WxPython-compatible module containing a widget with the ability to zoom and pan across an image in a similar manner to using Google Maps.

License

Notifications You must be signed in to change notification settings

cielivb/ImageInspector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github License

ImageInspector

About ImageInspector

ImageInspector is a widget module developed using WxPython that lets the user zoom and pan across a single image in a similar manner to using Google Maps.

ImageInspector enables the user to:

  • View a single .png, .jpg, or .webp image
  • Use click and release (including via touchscreen) to pan across an image
  • Double click to zoom in
  • Click on +/- buttons to zoom in and out
  • Use touchscreen pinch gesture to zoom in and out
  • Reset image state using the reset button

Example Videos using included Test App

Test App Example Video 1

Demonstrating pan and zoom ability on multiple ImageInspector instances.

demo1.mp4
Test App Example Video 2

Demonstrating pan and zoom ability as well as resize behaviour on a single ImageInspector instance.

demo2.mp4

ImageInspector Motivation

ImageInspector was developed with the intention of implementing it as part of a larger personal WxPython GUI application project. In the larger application, one or more ImageInspectors can be opened in response to one or more events, for example, a button press as demonstrated in the example videos below. ImageInspector is not intended to be a 'gallery explorer' which traverses across image files in a given directory. It is intended as a tool to aid in the visual inspection of a single image file.

Future enhancements

Future enhancements could include expanding the range of viewable image file types, restricting users from panning infinitely, adding an option to apply contrast enhancement masks, and adding a save image feature.

How to Use ImageInspector

You will need to install the following packages if you don't already have them: wx, numpy, pillow. ImageInspector has been specifically tested on Python 3.13.5, wxPython 4.2.4, numpy 2.2.6, pillow 12.0.0.

tests.py contains the code for a tiny WxPython app that implements ImageInspector. Use this as your reference. You will first need to import ImageInspector into your wxPython script. In your event handler, call image_inspector.view(parent=self, image_file='imagepath'). An ImageInspector displaying the image at your imagepath should appear.

Credits

This logic behind this project took much inspiration from this C++ demo example. Credits also to the WxPython docs, the WxWidgets docs, and the mountains of discussion forums on these sites!

License

This project is under the MIT License.

About

ImageInspector is a WxPython-compatible module containing a widget with the ability to zoom and pan across an image in a similar manner to using Google Maps.

Resources

License

Stars

Watchers

Forks

Languages