fotolab 0.28.3__py3-none-any.whl → 0.28.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fotolab/__init__.py +3 -2
- fotolab/subcommands/contrast.py +19 -5
- {fotolab-0.28.3.dist-info → fotolab-0.28.5.dist-info}/METADATA +7 -6
- {fotolab-0.28.3.dist-info → fotolab-0.28.5.dist-info}/RECORD +7 -7
- {fotolab-0.28.3.dist-info → fotolab-0.28.5.dist-info}/LICENSE.md +0 -0
- {fotolab-0.28.3.dist-info → fotolab-0.28.5.dist-info}/WHEEL +0 -0
- {fotolab-0.28.3.dist-info → fotolab-0.28.5.dist-info}/entry_points.txt +0 -0
fotolab/__init__.py
CHANGED
@@ -23,7 +23,7 @@ from pathlib import Path
|
|
23
23
|
|
24
24
|
from PIL import Image
|
25
25
|
|
26
|
-
__version__ = "0.28.
|
26
|
+
__version__ = "0.28.5"
|
27
27
|
|
28
28
|
log = logging.getLogger(__name__)
|
29
29
|
|
@@ -99,7 +99,8 @@ def _open_image(filename):
|
|
99
99
|
elif sys.platform == "darwin":
|
100
100
|
subprocess.call(["open", filename])
|
101
101
|
elif sys.platform == "windows":
|
102
|
-
subprocess.Popen(["open", filename])
|
102
|
+
with subprocess.Popen(["open", filename], shell=True) as proc:
|
103
|
+
proc.wait()
|
103
104
|
log.info("open image: %s", filename.resolve())
|
104
105
|
|
105
106
|
except OSError as error:
|
fotolab/subcommands/contrast.py
CHANGED
@@ -25,10 +25,24 @@ from fotolab import save_image
|
|
25
25
|
log = logging.getLogger(__name__)
|
26
26
|
|
27
27
|
|
28
|
-
|
28
|
+
# pylint: disable=protected-access
|
29
|
+
def _validate_cutoff(value: str) -> float:
|
30
|
+
"""Validate the cutoff value."""
|
31
|
+
try:
|
32
|
+
f_value = float(value)
|
33
|
+
except ValueError as e:
|
34
|
+
raise argparse.ArgumentTypeError(f"invalid float value: '{value}'") from e
|
35
|
+
if not 0 <= f_value <= 50:
|
36
|
+
raise argparse.ArgumentTypeError(
|
37
|
+
f"cutoff value {f_value} must be between 0 and 50"
|
38
|
+
)
|
39
|
+
return f_value
|
40
|
+
|
41
|
+
|
42
|
+
def build_subparser(subparsers: argparse._SubParsersAction) -> None:
|
29
43
|
"""Build the subparser."""
|
30
44
|
contrast_parser = subparsers.add_parser(
|
31
|
-
"contrast", help="contrast an image"
|
45
|
+
"contrast", help="contrast an image."
|
32
46
|
)
|
33
47
|
|
34
48
|
contrast_parser.set_defaults(func=run)
|
@@ -46,10 +60,10 @@ def build_subparser(subparsers) -> None:
|
|
46
60
|
"-c",
|
47
61
|
"--cutoff",
|
48
62
|
dest="cutoff",
|
49
|
-
type=
|
50
|
-
default=1,
|
63
|
+
type=_validate_cutoff,
|
64
|
+
default=1.0,
|
51
65
|
help=(
|
52
|
-
"set the percentage of lightest or darkest pixels"
|
66
|
+
"set the percentage (0-50) of lightest or darkest pixels"
|
53
67
|
" to discard from histogram"
|
54
68
|
" (default: '%(default)s')"
|
55
69
|
),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fotolab
|
3
|
-
Version: 0.28.
|
3
|
+
Version: 0.28.5
|
4
4
|
Summary: A console program that manipulate images.
|
5
5
|
Keywords: photography,photo
|
6
6
|
Author-email: Kian-Meng Ang <kianmeng@cpan.org>
|
@@ -165,15 +165,16 @@ positional arguments:
|
|
165
165
|
options:
|
166
166
|
-h, --help show this help message and exit
|
167
167
|
-c, --color COLOR set the color of border (default: 'black')
|
168
|
-
-w, --width WIDTH set the width of border (default: '10')
|
168
|
+
-w, --width WIDTH set the width of border in pixels (default: '10')
|
169
169
|
-wt, --width-top WIDTH
|
170
|
-
set the width of top border (default: '0')
|
170
|
+
set the width of top border in pixels (default: '0')
|
171
171
|
-wr, --width-right WIDTH
|
172
|
-
set the width of right border (default: '0')
|
172
|
+
set the width of right border in pixels (default: '0')
|
173
173
|
-wb, --width-bottom WIDTH
|
174
|
-
set the width of bottom border (default:
|
174
|
+
set the width of bottom border in pixels (default:
|
175
|
+
'0')
|
175
176
|
-wl, --width-left WIDTH
|
176
|
-
set the width of left border (default: '0')
|
177
|
+
set the width of left border in pixels (default: '0')
|
177
178
|
-op, --open open the image using default program (default:
|
178
179
|
'False')
|
179
180
|
-od, --output-dir OUTPUT_DIR
|
@@ -1,11 +1,11 @@
|
|
1
|
-
fotolab/__init__.py,sha256=
|
1
|
+
fotolab/__init__.py,sha256=qytheZnIjS5g0aUnq6-ChflsFcLasoz97T7GReoaeeQ,3301
|
2
2
|
fotolab/__main__.py,sha256=aboOURPs_snOXTEWYR0q8oq1UTY9e-NxCd1j33V0wHI,833
|
3
3
|
fotolab/cli.py,sha256=fIApD9C4Vkn-u4CejOFTboSV5f-Ks9vBGxeb-_ca-Nw,3935
|
4
4
|
fotolab/subcommands/__init__.py,sha256=l3DlIaJ3u3jGjnC1H1yV8LZ_nPqOLJ6gikD4BCaMAQ0,1129
|
5
5
|
fotolab/subcommands/animate.py,sha256=OcS6Q6JM1TW6HF0dSgBsV9mpEGwDMcJlQssupkf0_ZA,3393
|
6
6
|
fotolab/subcommands/auto.py,sha256=ia-xegV1Z4HvYsbKgmTzf1NfNFdTDPWfZe7vQ1_90Ik,2425
|
7
7
|
fotolab/subcommands/border.py,sha256=BS3BHytdWiNumxdKulKYK-WigbsKtPxECdvInUhUjSQ,4608
|
8
|
-
fotolab/subcommands/contrast.py,sha256=
|
8
|
+
fotolab/subcommands/contrast.py,sha256=ZHTvAJhRYZjNTrkHRZq3O6wba3LS7QjH1BfiGf4ZvGY,3005
|
9
9
|
fotolab/subcommands/env.py,sha256=QoxRvzZKgmoHTUxDV4QYhdChCpMWs5TbXFY_qIpIQpE,1469
|
10
10
|
fotolab/subcommands/halftone.py,sha256=bRGG_Bg1T5ZV3UWsdMszOdPmc6g9_R0yNp5mb0g8hcE,4152
|
11
11
|
fotolab/subcommands/info.py,sha256=Qp-Zu7Xp1ptLK211hOkFM5oxZWGTrlNBqCpbx2IjL9Y,3371
|
@@ -14,8 +14,8 @@ fotolab/subcommands/resize.py,sha256=UOb2rg_5ArRj0gxPTDOww_ix3tqJRC0W5b_S-Lt1G4w
|
|
14
14
|
fotolab/subcommands/rotate.py,sha256=uBFjHyjiBSQLtrtH1p9myODIHUDr1gkL4PpU-6Y1Ofo,2575
|
15
15
|
fotolab/subcommands/sharpen.py,sha256=YNho2IPbc-lPvSy3Bsjehc2JOEy27LPqFSGRULs9MyY,3492
|
16
16
|
fotolab/subcommands/watermark.py,sha256=A_dUy_yf9wPHUexB9aIicFIS-BpWrjjfI8Hr4WCCBoc,9449
|
17
|
-
fotolab-0.28.
|
18
|
-
fotolab-0.28.
|
19
|
-
fotolab-0.28.
|
20
|
-
fotolab-0.28.
|
21
|
-
fotolab-0.28.
|
17
|
+
fotolab-0.28.5.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
|
18
|
+
fotolab-0.28.5.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
19
|
+
fotolab-0.28.5.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
20
|
+
fotolab-0.28.5.dist-info/METADATA,sha256=0SIqAZceh2lv4iQkVoJu-7nRab99nDecITkquNUXFuU,12970
|
21
|
+
fotolab-0.28.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|