Skip to content

Commit

Permalink
implement brighten by 20% in viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
Sacha committed Nov 23, 2024
1 parent f3a3f48 commit 37ec02c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
version 0.9.8 (SH Nov 23 2024)
- Implement brighten by 20% in viewer

version 0.9.7 (SH Feb 10 2024)
- Implement rotate right, left in viewer

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "simimg"
version = "0.9.7"
version = "0.9.8"
description = "Similar Image Finder"
authors = [
{ name = "sacha", email = "[email protected]" },
Expand Down
6 changes: 6 additions & 0 deletions simimg/dialogs/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from tkinter import messagebox as tkmessagebox
from PIL.Image import ROTATE_270, ROTATE_90
from PIL.ImageOps import autocontrast, equalize, grayscale, mirror
from PIL.ImageEnhance import Brightness

import simimg.utils.pillowplus as PP

Expand All @@ -14,6 +15,8 @@ def _rotate_left(im):
def _rotate_right(im):
return im.transpose(ROTATE_90)

def _brighten(im):
return Brightness(im).enhance(1.2)

class Viewer(tk.Toplevel):
"A viewer window to display the selected pictures"
Expand All @@ -39,6 +42,7 @@ def __init__(self, Fileinfo=None, Controller=None):
"flip": mirror,
"rotate_left": _rotate_left,
"rotate_right": _rotate_right,
"brighten": _brighten,
}
self._default_imageops = {k: "d" for k in self._func_map}
self._wantedImageOps = copy(self._default_imageops)
Expand Down Expand Up @@ -70,6 +74,7 @@ def __init__(self, Fileinfo=None, Controller=None):
"g": partial(self._toggleImageOp, opp="grayscale"),
"r": partial(self._toggleImageOp, opp="rotate_left"),
"l": partial(self._toggleImageOp, opp="rotate_right"),
"b": partial(self._toggleImageOp, opp="brighten"),
"F1": self._showHelp,
"q": self._exitViewer,
"Escape": self._exitViewer
Expand Down Expand Up @@ -306,6 +311,7 @@ def _showHelp(self):
g: toggle converting the image to grayscale
l: toggle rotating the image to the left (anti-clockwise)
r: toggle rotating the image to the right (clockwise)
b: toggle brightening the image by 20%
m: move the file to the folder set in the main window
<n>: move the file to the folder #n move panel of the main window
q, Escape: quit the viewer
Expand Down

0 comments on commit 37ec02c

Please sign in to comment.