Image viewer built with python and the Qt5 framework
- Open
jpg
images usingCtrl + O
orFile 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 + R
orView Menu -> Reset Zoom
- Zoom in using
- Edit Image Contrast:
- Once image is loaded in, use
Ctrl + F
orView 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 + S
orFile Menu -> Save Image
to save image - Image will be saved in the directory of where the project is being run
- Once image is edited, use
- Utilized Python
PyQt5
framework to run a native desktop application - Opens file as a
QImage
and converts it to aQPixMap
to render as aQLabel
on application the user interacts with - Zoom features are implemented using the
scale
andresize
properties 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
/Pillow
library to modify contrast levels- When image is opened, a image buffer is created before the
QImage
is converted toQPixMap
- This buffer is loaded into
PIL
for modification - Meanwhile, a second window
ContrastView
is rendered on the screen with a simple slider (QSlider
) that sets contrast levels - There is a
onValueChanged
property for theQSlider
that is used to update the count value next to the slider and also used to pass the value into theImageEnhancer
fromPIL
for contrast level modifications - Once
PIL
modifies the image, the image needs to be converted back fromPIL
into aQImage
to reset theQPixMap
that is used to display the image to the user. This is done by leveragingImageQt
provided fromPIL
by casting the edited image intoImageQt
which 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 thePIL
library
- Install required dependencies using
pip
pip install -r requirements.txt
-
Or manually install dependencies
pip install PyQt5
pip install Pillow
-
Run
ImageViewer.py
python ImageViewer.py