Image viewer built with python and the Qt5 framework
- Open
jpgimages usingCtrl + OorFile menu -> Open - Move around image using trackpad or mouse with scroll bars
- Zoom:
- Zoom in using
Ctrl + +orView Menu -> Zoom In - Zoom out using
Ctrl + -orView Menu -> Zoom Out - Reset Zoom using
Ctrl + RorView Menu -> Reset Zoom
- Zoom in using
- Edit Image Contrast:
- Once image is loaded in, use
Ctrl + ForView Menu -> Edit Image Contrast(Opens new small window with slider) - Move slider around to view changes
- Once image is loaded in, use
- Save Image:
- Once image is edited, use
Ctrl + SorFile Menu -> Save Imageto save image - Image will be saved in the directory of where the project is being run
- Once image is edited, use
- Utilized Python
PyQt5framework to run a native desktop application - Opens file as a
QImageand converts it to aQPixMapto render as aQLabelon application the user interacts with - Zoom features are implemented using the
scaleandresizeproperties ofQLabel- Scales image with a factor of +/- 25%
- Reset zoom option just sets the resize back to original image size
- Contrast feature is implemented using the
PIL/Pillowlibrary to modify contrast levels- When image is opened, a image buffer is created before the
QImageis converted toQPixMap - This buffer is loaded into
PILfor modification - Meanwhile, a second window
ContrastViewis rendered on the screen with a simple slider (QSlider) that sets contrast levels - There is a
onValueChangedproperty for theQSliderthat is used to update the count value next to the slider and also used to pass the value into theImageEnhancerfromPILfor contrast level modifications - Once
PILmodifies the image, the image needs to be converted back fromPILinto aQImageto reset theQPixMapthat is used to display the image to the user. This is done by leveragingImageQtprovided fromPILby casting the edited image intoImageQtwhich can then be passed onto the image label for setting theQPixMap - The image buffer is reset everytime a new image is opened
- When image is opened, a image buffer is created before the
- Saving feature is implemented using the built-in
save()function in thePILlibrary
- Install required dependencies using
pip
pip install -r requirements.txt
-
Or manually install dependencies
pip install PyQt5pip install Pillow
-
Run
ImageViewer.py
python ImageViewer.py
