fotolab 0.34.2__tar.gz → 0.34.3__tar.gz
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-0.34.2/src/fotolab.egg-info → fotolab-0.34.3}/PKG-INFO +1 -1
- {fotolab-0.34.2 → fotolab-0.34.3}/pyproject.toml +8 -8
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/subcommands/__init__.py +1 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/subcommands/animate.py +3 -26
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/subcommands/auto.py +3 -10
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/subcommands/border.py +3 -26
- fotolab-0.34.3/src/fotolab/subcommands/common.py +68 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/subcommands/contrast.py +3 -26
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/subcommands/halftone.py +3 -26
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/subcommands/info.py +3 -1
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/subcommands/montage.py +3 -26
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/subcommands/resize.py +3 -26
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/subcommands/rotate.py +3 -26
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/subcommands/sharpen.py +3 -26
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/subcommands/watermark.py +3 -26
- {fotolab-0.34.2 → fotolab-0.34.3/src/fotolab.egg-info}/PKG-INFO +1 -1
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab.egg-info/SOURCES.txt +1 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/LICENSE.md +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/README.md +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/setup.cfg +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/__init__.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/__main__.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/cli.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab/subcommands/env.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab.egg-info/dependency_links.txt +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab.egg-info/entry_points.txt +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab.egg-info/requires.txt +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/src/fotolab.egg-info/top_level.txt +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/tests/test_animate_subcommand.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/tests/test_auto_subcommand.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/tests/test_border_subcommand.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/tests/test_contrast_subcommand.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/tests/test_env_subcommand.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/tests/test_halftone_subcommand.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/tests/test_help_flag.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/tests/test_info_subcommand.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/tests/test_montage_subcommand.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/tests/test_quiet_flag.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/tests/test_resize_subcommand.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/tests/test_rotate_subcommand.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/tests/test_sharpen_subcommand.py +0 -0
- {fotolab-0.34.2 → fotolab-0.34.3}/tests/test_watermark_subcommand.py +0 -0
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools>=61.0"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[tool.setuptools.packages.find]
|
|
6
|
-
where = ["src"]
|
|
7
|
-
|
|
8
1
|
[project]
|
|
9
2
|
name = "fotolab"
|
|
10
|
-
version = "0.34.
|
|
3
|
+
version = "0.34.3"
|
|
11
4
|
description = "A console program to manipulate photos."
|
|
12
5
|
authors = [{name = "Kian-Meng Ang", email = "kianmeng@cpan.org"}]
|
|
13
6
|
requires-python = ">=3.10"
|
|
@@ -59,6 +52,13 @@ lint = [
|
|
|
59
52
|
"ruff",
|
|
60
53
|
]
|
|
61
54
|
|
|
55
|
+
[build-system]
|
|
56
|
+
requires = ["setuptools>=61.0"]
|
|
57
|
+
build-backend = "setuptools.build_meta"
|
|
58
|
+
|
|
59
|
+
[tool.setuptools.packages.find]
|
|
60
|
+
where = ["src"]
|
|
61
|
+
|
|
62
62
|
# verify through: uv run ruff check --show-settings
|
|
63
63
|
[tool.ruff]
|
|
64
64
|
line-length = 79
|
|
@@ -22,6 +22,7 @@ from contextlib import ExitStack
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
from fotolab import load_image, open_image
|
|
25
|
+
from .common import add_common_arguments, log_args_decorator
|
|
25
26
|
|
|
26
27
|
log = logging.getLogger(__name__)
|
|
27
28
|
|
|
@@ -47,14 +48,7 @@ def build_subparser(subparsers) -> None:
|
|
|
47
48
|
|
|
48
49
|
animate_parser.set_defaults(func=run)
|
|
49
50
|
|
|
50
|
-
animate_parser
|
|
51
|
-
dest="image_paths",
|
|
52
|
-
help="set the image filenames",
|
|
53
|
-
nargs="+",
|
|
54
|
-
type=str,
|
|
55
|
-
default=None,
|
|
56
|
-
metavar="IMAGE_PATHS",
|
|
57
|
-
)
|
|
51
|
+
add_common_arguments(animate_parser)
|
|
58
52
|
|
|
59
53
|
animate_parser.add_argument(
|
|
60
54
|
"-f",
|
|
@@ -90,15 +84,6 @@ def build_subparser(subparsers) -> None:
|
|
|
90
84
|
metavar="LOOP",
|
|
91
85
|
)
|
|
92
86
|
|
|
93
|
-
animate_parser.add_argument(
|
|
94
|
-
"-op",
|
|
95
|
-
"--open",
|
|
96
|
-
default=False,
|
|
97
|
-
action="store_true",
|
|
98
|
-
dest="open",
|
|
99
|
-
help="open the image using default program (default: '%(default)s')",
|
|
100
|
-
)
|
|
101
|
-
|
|
102
87
|
animate_parser.add_argument(
|
|
103
88
|
"--webp-quality",
|
|
104
89
|
dest="webp_quality",
|
|
@@ -130,14 +115,6 @@ def build_subparser(subparsers) -> None:
|
|
|
130
115
|
metavar="METHOD",
|
|
131
116
|
)
|
|
132
117
|
|
|
133
|
-
animate_parser.add_argument(
|
|
134
|
-
"-od",
|
|
135
|
-
"--output-dir",
|
|
136
|
-
dest="output_dir",
|
|
137
|
-
default="output",
|
|
138
|
-
help="set default output folder (default: '%(default)s')",
|
|
139
|
-
)
|
|
140
|
-
|
|
141
118
|
animate_parser.add_argument(
|
|
142
119
|
"-of",
|
|
143
120
|
"--output-filename",
|
|
@@ -147,6 +124,7 @@ def build_subparser(subparsers) -> None:
|
|
|
147
124
|
)
|
|
148
125
|
|
|
149
126
|
|
|
127
|
+
@log_args_decorator
|
|
150
128
|
def run(args: argparse.Namespace) -> None:
|
|
151
129
|
"""Run animate subcommand.
|
|
152
130
|
|
|
@@ -156,7 +134,6 @@ def run(args: argparse.Namespace) -> None:
|
|
|
156
134
|
Returns:
|
|
157
135
|
None
|
|
158
136
|
"""
|
|
159
|
-
log.debug(args)
|
|
160
137
|
|
|
161
138
|
image_filepaths = [Path(f) for f in args.image_paths]
|
|
162
139
|
first_image_filepath = image_filepaths[0]
|
|
@@ -23,6 +23,7 @@ import fotolab.subcommands.contrast
|
|
|
23
23
|
import fotolab.subcommands.resize
|
|
24
24
|
import fotolab.subcommands.sharpen
|
|
25
25
|
import fotolab.subcommands.watermark
|
|
26
|
+
from .common import add_common_arguments, log_args_decorator
|
|
26
27
|
|
|
27
28
|
log = logging.getLogger(__name__)
|
|
28
29
|
|
|
@@ -35,14 +36,7 @@ def build_subparser(subparsers) -> None:
|
|
|
35
36
|
|
|
36
37
|
auto_parser.set_defaults(func=run)
|
|
37
38
|
|
|
38
|
-
auto_parser
|
|
39
|
-
dest="image_paths",
|
|
40
|
-
help="set the image filename",
|
|
41
|
-
nargs="+",
|
|
42
|
-
type=str,
|
|
43
|
-
default=None,
|
|
44
|
-
metavar="IMAGE_PATHS",
|
|
45
|
-
)
|
|
39
|
+
add_common_arguments(auto_parser)
|
|
46
40
|
|
|
47
41
|
auto_parser.add_argument(
|
|
48
42
|
"-t",
|
|
@@ -65,6 +59,7 @@ def build_subparser(subparsers) -> None:
|
|
|
65
59
|
)
|
|
66
60
|
|
|
67
61
|
|
|
62
|
+
@log_args_decorator
|
|
68
63
|
def run(args: argparse.Namespace) -> None:
|
|
69
64
|
"""Run auto subcommand.
|
|
70
65
|
|
|
@@ -106,7 +101,6 @@ def run(args: argparse.Namespace) -> None:
|
|
|
106
101
|
combined_args.overwrite = True
|
|
107
102
|
combined_args.open = False
|
|
108
103
|
|
|
109
|
-
log.debug(args)
|
|
110
104
|
log.debug(combined_args)
|
|
111
105
|
|
|
112
106
|
fotolab.subcommands.resize.run(combined_args)
|
|
@@ -118,7 +112,6 @@ def run(args: argparse.Namespace) -> None:
|
|
|
118
112
|
output_filename = (
|
|
119
113
|
args.title.lower().replace(",", "").replace(" ", "_") + ".gif"
|
|
120
114
|
)
|
|
121
|
-
combined_args.output_dir = "output"
|
|
122
115
|
combined_args.format = "gif"
|
|
123
116
|
combined_args.duration = 2500
|
|
124
117
|
combined_args.loop = 0
|
|
@@ -23,6 +23,7 @@ from typing import Tuple
|
|
|
23
23
|
from PIL import ImageColor, ImageOps
|
|
24
24
|
|
|
25
25
|
from fotolab import load_image, save_image
|
|
26
|
+
from .common import add_common_arguments, log_args_decorator
|
|
26
27
|
|
|
27
28
|
log = logging.getLogger(__name__)
|
|
28
29
|
|
|
@@ -33,14 +34,7 @@ def build_subparser(subparsers: argparse._SubParsersAction) -> None:
|
|
|
33
34
|
|
|
34
35
|
border_parser.set_defaults(func=run)
|
|
35
36
|
|
|
36
|
-
border_parser
|
|
37
|
-
dest="image_paths",
|
|
38
|
-
help="set the image filenames",
|
|
39
|
-
nargs="+",
|
|
40
|
-
type=str,
|
|
41
|
-
default=None,
|
|
42
|
-
metavar="IMAGE_PATHS",
|
|
43
|
-
)
|
|
37
|
+
add_common_arguments(border_parser)
|
|
44
38
|
|
|
45
39
|
border_parser.add_argument(
|
|
46
40
|
"-c",
|
|
@@ -106,24 +100,8 @@ def build_subparser(subparsers: argparse._SubParsersAction) -> None:
|
|
|
106
100
|
metavar="WIDTH",
|
|
107
101
|
)
|
|
108
102
|
|
|
109
|
-
border_parser.add_argument(
|
|
110
|
-
"-op",
|
|
111
|
-
"--open",
|
|
112
|
-
default=False,
|
|
113
|
-
action="store_true",
|
|
114
|
-
dest="open",
|
|
115
|
-
help="open the image using default program (default: '%(default)s')",
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
border_parser.add_argument(
|
|
119
|
-
"-od",
|
|
120
|
-
"--output-dir",
|
|
121
|
-
dest="output_dir",
|
|
122
|
-
default="output",
|
|
123
|
-
help="set default output folder (default: '%(default)s')",
|
|
124
|
-
)
|
|
125
|
-
|
|
126
103
|
|
|
104
|
+
@log_args_decorator
|
|
127
105
|
def run(args: argparse.Namespace) -> None:
|
|
128
106
|
"""Run border subcommand.
|
|
129
107
|
|
|
@@ -133,7 +111,6 @@ def run(args: argparse.Namespace) -> None:
|
|
|
133
111
|
Returns:
|
|
134
112
|
None
|
|
135
113
|
"""
|
|
136
|
-
log.debug(args)
|
|
137
114
|
|
|
138
115
|
for image_filepath in [Path(f) for f in args.image_paths]:
|
|
139
116
|
with load_image(image_filepath) as original_image:
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Copyright (C) 2024,2025 Kian-Meng Ang
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify it under
|
|
4
|
+
# the terms of the GNU Affero General Public License as published by the Free
|
|
5
|
+
#
|
|
6
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
# later version.
|
|
8
|
+
#
|
|
9
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
10
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
12
|
+
# details.
|
|
13
|
+
#
|
|
14
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
|
|
17
|
+
"""Common argument parsing for subcommands."""
|
|
18
|
+
|
|
19
|
+
import argparse
|
|
20
|
+
import logging
|
|
21
|
+
from functools import wraps
|
|
22
|
+
from typing import Callable
|
|
23
|
+
|
|
24
|
+
log = logging.getLogger(__name__)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def log_args_decorator(func: Callable) -> Callable:
|
|
28
|
+
"""Decorator to log the arguments passed to a function."""
|
|
29
|
+
|
|
30
|
+
@wraps(func)
|
|
31
|
+
def wrapper(args: argparse.Namespace) -> None:
|
|
32
|
+
log.debug(args)
|
|
33
|
+
return func(args)
|
|
34
|
+
|
|
35
|
+
return wrapper
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def add_common_arguments(parser: argparse.ArgumentParser) -> None:
|
|
39
|
+
"""Add common arguments to a subparser.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
parser (argparse.ArgumentParser): The subparser to add arguments to.
|
|
43
|
+
"""
|
|
44
|
+
parser.add_argument(
|
|
45
|
+
dest="image_paths",
|
|
46
|
+
help="set the image filenames",
|
|
47
|
+
nargs="+",
|
|
48
|
+
type=str,
|
|
49
|
+
default=None,
|
|
50
|
+
metavar="IMAGE_PATHS",
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
parser.add_argument(
|
|
54
|
+
"-op",
|
|
55
|
+
"--open",
|
|
56
|
+
default=False,
|
|
57
|
+
action="store_true",
|
|
58
|
+
dest="open",
|
|
59
|
+
help="open the image using default program (default: '%(default)s')",
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
parser.add_argument(
|
|
63
|
+
"-od",
|
|
64
|
+
"--output-dir",
|
|
65
|
+
dest="output_dir",
|
|
66
|
+
default="output",
|
|
67
|
+
help="set default output folder (default: '%(default)s')",
|
|
68
|
+
)
|
|
@@ -22,6 +22,7 @@ from pathlib import Path
|
|
|
22
22
|
from PIL import ImageOps
|
|
23
23
|
|
|
24
24
|
from fotolab import load_image, save_image
|
|
25
|
+
from .common import add_common_arguments, log_args_decorator
|
|
25
26
|
|
|
26
27
|
log = logging.getLogger(__name__)
|
|
27
28
|
|
|
@@ -50,14 +51,7 @@ def build_subparser(subparsers: argparse._SubParsersAction) -> None:
|
|
|
50
51
|
|
|
51
52
|
contrast_parser.set_defaults(func=run)
|
|
52
53
|
|
|
53
|
-
contrast_parser
|
|
54
|
-
dest="image_paths",
|
|
55
|
-
help="set the image filename",
|
|
56
|
-
nargs="+",
|
|
57
|
-
type=str,
|
|
58
|
-
default=None,
|
|
59
|
-
metavar="IMAGE_PATHS",
|
|
60
|
-
)
|
|
54
|
+
add_common_arguments(contrast_parser)
|
|
61
55
|
|
|
62
56
|
contrast_parser.add_argument(
|
|
63
57
|
"-c",
|
|
@@ -73,24 +67,8 @@ def build_subparser(subparsers: argparse._SubParsersAction) -> None:
|
|
|
73
67
|
metavar="CUTOFF",
|
|
74
68
|
)
|
|
75
69
|
|
|
76
|
-
contrast_parser.add_argument(
|
|
77
|
-
"-op",
|
|
78
|
-
"--open",
|
|
79
|
-
default=False,
|
|
80
|
-
action="store_true",
|
|
81
|
-
dest="open",
|
|
82
|
-
help="open the image using default program (default: '%(default)s')",
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
contrast_parser.add_argument(
|
|
86
|
-
"-od",
|
|
87
|
-
"--output-dir",
|
|
88
|
-
dest="output_dir",
|
|
89
|
-
default="output",
|
|
90
|
-
help="set default output folder (default: '%(default)s')",
|
|
91
|
-
)
|
|
92
|
-
|
|
93
70
|
|
|
71
|
+
@log_args_decorator
|
|
94
72
|
def run(args: argparse.Namespace) -> None:
|
|
95
73
|
"""Run contrast subcommand.
|
|
96
74
|
|
|
@@ -100,7 +78,6 @@ def run(args: argparse.Namespace) -> None:
|
|
|
100
78
|
Returns:
|
|
101
79
|
None
|
|
102
80
|
"""
|
|
103
|
-
log.debug(args)
|
|
104
81
|
|
|
105
82
|
for image_path_str in args.image_paths:
|
|
106
83
|
with load_image(Path(image_path_str)) as original_image:
|
|
@@ -24,6 +24,7 @@ from typing import NamedTuple
|
|
|
24
24
|
from PIL import Image, ImageDraw
|
|
25
25
|
|
|
26
26
|
from fotolab import load_image, save_gif_image, save_image
|
|
27
|
+
from .common import add_common_arguments, log_args_decorator
|
|
27
28
|
|
|
28
29
|
log = logging.getLogger(__name__)
|
|
29
30
|
|
|
@@ -44,14 +45,7 @@ def build_subparser(subparsers) -> None:
|
|
|
44
45
|
|
|
45
46
|
halftone_parser.set_defaults(func=run)
|
|
46
47
|
|
|
47
|
-
halftone_parser
|
|
48
|
-
dest="image_paths",
|
|
49
|
-
help="set the image filename",
|
|
50
|
-
nargs="+",
|
|
51
|
-
type=str,
|
|
52
|
-
default=None,
|
|
53
|
-
metavar="IMAGE_PATHS",
|
|
54
|
-
)
|
|
48
|
+
add_common_arguments(halftone_parser)
|
|
55
49
|
|
|
56
50
|
halftone_parser.add_argument(
|
|
57
51
|
"-ba",
|
|
@@ -62,23 +56,6 @@ def build_subparser(subparsers) -> None:
|
|
|
62
56
|
help="generate a GIF showing before and after changes",
|
|
63
57
|
)
|
|
64
58
|
|
|
65
|
-
halftone_parser.add_argument(
|
|
66
|
-
"-op",
|
|
67
|
-
"--open",
|
|
68
|
-
default=False,
|
|
69
|
-
action="store_true",
|
|
70
|
-
dest="open",
|
|
71
|
-
help="open the image using default program (default: '%(default)s')",
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
halftone_parser.add_argument(
|
|
75
|
-
"-od",
|
|
76
|
-
"--output-dir",
|
|
77
|
-
dest="output_dir",
|
|
78
|
-
default="output",
|
|
79
|
-
help="set default output folder (default: '%(default)s')",
|
|
80
|
-
)
|
|
81
|
-
|
|
82
59
|
halftone_parser.add_argument(
|
|
83
60
|
"-c",
|
|
84
61
|
"--cells",
|
|
@@ -100,6 +77,7 @@ def build_subparser(subparsers) -> None:
|
|
|
100
77
|
)
|
|
101
78
|
|
|
102
79
|
|
|
80
|
+
@log_args_decorator
|
|
103
81
|
def run(args: argparse.Namespace) -> None:
|
|
104
82
|
"""Run halftone subcommand.
|
|
105
83
|
|
|
@@ -109,7 +87,6 @@ def run(args: argparse.Namespace) -> None:
|
|
|
109
87
|
Returns:
|
|
110
88
|
None
|
|
111
89
|
"""
|
|
112
|
-
log.debug(args)
|
|
113
90
|
|
|
114
91
|
for image_path_str in args.image_paths:
|
|
115
92
|
image_filename = Path(image_path_str)
|
|
@@ -20,6 +20,8 @@ import logging
|
|
|
20
20
|
|
|
21
21
|
from PIL import ExifTags, Image
|
|
22
22
|
|
|
23
|
+
from .common import log_args_decorator
|
|
24
|
+
|
|
23
25
|
log = logging.getLogger(__name__)
|
|
24
26
|
|
|
25
27
|
|
|
@@ -62,6 +64,7 @@ def build_subparser(subparsers) -> None:
|
|
|
62
64
|
)
|
|
63
65
|
|
|
64
66
|
|
|
67
|
+
@log_args_decorator
|
|
65
68
|
def run(args: argparse.Namespace) -> None:
|
|
66
69
|
"""Run info subcommand.
|
|
67
70
|
|
|
@@ -71,7 +74,6 @@ def run(args: argparse.Namespace) -> None:
|
|
|
71
74
|
Returns:
|
|
72
75
|
None
|
|
73
76
|
"""
|
|
74
|
-
log.debug(args)
|
|
75
77
|
|
|
76
78
|
with Image.open(args.image_filename) as image:
|
|
77
79
|
exif_tags = extract_exif_tags(image, args.sort)
|
|
@@ -23,6 +23,7 @@ from contextlib import ExitStack
|
|
|
23
23
|
from PIL import Image
|
|
24
24
|
|
|
25
25
|
from fotolab import load_image, save_image
|
|
26
|
+
from .common import add_common_arguments, log_args_decorator
|
|
26
27
|
|
|
27
28
|
log = logging.getLogger(__name__)
|
|
28
29
|
|
|
@@ -35,33 +36,10 @@ def build_subparser(subparsers) -> None:
|
|
|
35
36
|
|
|
36
37
|
montage_parser.set_defaults(func=run)
|
|
37
38
|
|
|
38
|
-
montage_parser
|
|
39
|
-
dest="image_paths",
|
|
40
|
-
help="set the image filenames",
|
|
41
|
-
nargs="+",
|
|
42
|
-
type=str,
|
|
43
|
-
default=None,
|
|
44
|
-
metavar="IMAGE_PATHS",
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
montage_parser.add_argument(
|
|
48
|
-
"-op",
|
|
49
|
-
"--open",
|
|
50
|
-
default=False,
|
|
51
|
-
action="store_true",
|
|
52
|
-
dest="open",
|
|
53
|
-
help="open the image using default program (default: '%(default)s')",
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
montage_parser.add_argument(
|
|
57
|
-
"-od",
|
|
58
|
-
"--output-dir",
|
|
59
|
-
dest="output_dir",
|
|
60
|
-
default="output",
|
|
61
|
-
help="set default output folder (default: '%(default)s')",
|
|
62
|
-
)
|
|
39
|
+
add_common_arguments(montage_parser)
|
|
63
40
|
|
|
64
41
|
|
|
42
|
+
@log_args_decorator
|
|
65
43
|
def run(args: argparse.Namespace) -> None:
|
|
66
44
|
"""Run montage subcommand.
|
|
67
45
|
|
|
@@ -71,7 +49,6 @@ def run(args: argparse.Namespace) -> None:
|
|
|
71
49
|
Returns:
|
|
72
50
|
None
|
|
73
51
|
"""
|
|
74
|
-
log.debug(args)
|
|
75
52
|
images = []
|
|
76
53
|
with ExitStack() as stack:
|
|
77
54
|
for image_path_str in args.image_paths:
|
|
@@ -23,6 +23,7 @@ from pathlib import Path
|
|
|
23
23
|
from PIL import Image, ImageColor
|
|
24
24
|
|
|
25
25
|
from fotolab import load_image, save_image
|
|
26
|
+
from .common import add_common_arguments, log_args_decorator
|
|
26
27
|
|
|
27
28
|
log = logging.getLogger(__name__)
|
|
28
29
|
|
|
@@ -36,14 +37,7 @@ def build_subparser(subparsers) -> None:
|
|
|
36
37
|
|
|
37
38
|
resize_parser.set_defaults(func=run)
|
|
38
39
|
|
|
39
|
-
resize_parser
|
|
40
|
-
dest="image_paths",
|
|
41
|
-
help="set the image filename",
|
|
42
|
-
nargs="+",
|
|
43
|
-
type=str,
|
|
44
|
-
default=None,
|
|
45
|
-
metavar="IMAGE_PATHS",
|
|
46
|
-
)
|
|
40
|
+
add_common_arguments(resize_parser)
|
|
47
41
|
|
|
48
42
|
resize_parser.add_argument(
|
|
49
43
|
"-c",
|
|
@@ -87,24 +81,8 @@ def build_subparser(subparsers) -> None:
|
|
|
87
81
|
metavar="HEIGHT",
|
|
88
82
|
)
|
|
89
83
|
|
|
90
|
-
resize_parser.add_argument(
|
|
91
|
-
"-op",
|
|
92
|
-
"--open",
|
|
93
|
-
default=False,
|
|
94
|
-
action="store_true",
|
|
95
|
-
dest="open",
|
|
96
|
-
help="open the image using default program (default: '%(default)s')",
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
resize_parser.add_argument(
|
|
100
|
-
"-od",
|
|
101
|
-
"--output-dir",
|
|
102
|
-
dest="output_dir",
|
|
103
|
-
default="output",
|
|
104
|
-
help="set default output folder (default: '%(default)s')",
|
|
105
|
-
)
|
|
106
|
-
|
|
107
84
|
|
|
85
|
+
@log_args_decorator
|
|
108
86
|
def run(args: argparse.Namespace) -> None:
|
|
109
87
|
"""Run resize subcommand.
|
|
110
88
|
|
|
@@ -114,7 +92,6 @@ def run(args: argparse.Namespace) -> None:
|
|
|
114
92
|
Returns:
|
|
115
93
|
None
|
|
116
94
|
"""
|
|
117
|
-
log.debug(args)
|
|
118
95
|
|
|
119
96
|
width_provided = args.width != DEFAULT_WIDTH
|
|
120
97
|
height_provided = args.height != DEFAULT_HEIGHT
|
|
@@ -22,6 +22,7 @@ from pathlib import Path
|
|
|
22
22
|
from PIL import Image
|
|
23
23
|
|
|
24
24
|
from fotolab import load_image, save_image
|
|
25
|
+
from .common import add_common_arguments, log_args_decorator
|
|
25
26
|
|
|
26
27
|
log = logging.getLogger(__name__)
|
|
27
28
|
|
|
@@ -32,14 +33,7 @@ def build_subparser(subparsers) -> None:
|
|
|
32
33
|
|
|
33
34
|
rotate_parser.set_defaults(func=run)
|
|
34
35
|
|
|
35
|
-
rotate_parser
|
|
36
|
-
dest="image_paths",
|
|
37
|
-
help="set the image filenames",
|
|
38
|
-
nargs="+",
|
|
39
|
-
type=str,
|
|
40
|
-
default=None,
|
|
41
|
-
metavar="IMAGE_PATHS",
|
|
42
|
-
)
|
|
36
|
+
add_common_arguments(rotate_parser)
|
|
43
37
|
|
|
44
38
|
rotate_parser.add_argument(
|
|
45
39
|
"-r",
|
|
@@ -56,24 +50,8 @@ def build_subparser(subparsers) -> None:
|
|
|
56
50
|
help="Rotate clockwise (default: '%(default)s)",
|
|
57
51
|
)
|
|
58
52
|
|
|
59
|
-
rotate_parser.add_argument(
|
|
60
|
-
"-op",
|
|
61
|
-
"--open",
|
|
62
|
-
default=False,
|
|
63
|
-
action="store_true",
|
|
64
|
-
dest="open",
|
|
65
|
-
help="open the image using default program (default: '%(default)s')",
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
rotate_parser.add_argument(
|
|
69
|
-
"-od",
|
|
70
|
-
"--output-dir",
|
|
71
|
-
dest="output_dir",
|
|
72
|
-
default="output",
|
|
73
|
-
help="set default output folder (default: '%(default)s')",
|
|
74
|
-
)
|
|
75
|
-
|
|
76
53
|
|
|
54
|
+
@log_args_decorator
|
|
77
55
|
def run(args: argparse.Namespace) -> None:
|
|
78
56
|
"""Run rotate subcommand.
|
|
79
57
|
|
|
@@ -83,7 +61,6 @@ def run(args: argparse.Namespace) -> None:
|
|
|
83
61
|
Returns:
|
|
84
62
|
None
|
|
85
63
|
"""
|
|
86
|
-
log.debug(args)
|
|
87
64
|
|
|
88
65
|
rotation = -args.rotation if args.clockwise else args.rotation
|
|
89
66
|
log.debug(f"Rotation angle: {rotation} degrees")
|
|
@@ -22,6 +22,7 @@ from pathlib import Path
|
|
|
22
22
|
from PIL import ImageFilter
|
|
23
23
|
|
|
24
24
|
from fotolab import load_image, save_gif_image, save_image
|
|
25
|
+
from .common import add_common_arguments, log_args_decorator
|
|
25
26
|
|
|
26
27
|
log = logging.getLogger(__name__)
|
|
27
28
|
|
|
@@ -32,14 +33,7 @@ def build_subparser(subparsers) -> None:
|
|
|
32
33
|
|
|
33
34
|
sharpen_parser.set_defaults(func=run)
|
|
34
35
|
|
|
35
|
-
sharpen_parser
|
|
36
|
-
dest="image_paths",
|
|
37
|
-
help="set the image filenames",
|
|
38
|
-
nargs="+",
|
|
39
|
-
type=str,
|
|
40
|
-
default=None,
|
|
41
|
-
metavar="IMAGE_PATHS",
|
|
42
|
-
)
|
|
36
|
+
add_common_arguments(sharpen_parser)
|
|
43
37
|
|
|
44
38
|
sharpen_parser.add_argument(
|
|
45
39
|
"-r",
|
|
@@ -86,24 +80,8 @@ def build_subparser(subparsers) -> None:
|
|
|
86
80
|
help="generate a GIF showing before and after changes",
|
|
87
81
|
)
|
|
88
82
|
|
|
89
|
-
sharpen_parser.add_argument(
|
|
90
|
-
"-op",
|
|
91
|
-
"--open",
|
|
92
|
-
default=False,
|
|
93
|
-
action="store_true",
|
|
94
|
-
dest="open",
|
|
95
|
-
help="open the image using default program (default: '%(default)s')",
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
sharpen_parser.add_argument(
|
|
99
|
-
"-od",
|
|
100
|
-
"--output-dir",
|
|
101
|
-
dest="output_dir",
|
|
102
|
-
default="output",
|
|
103
|
-
help="set default output folder (default: '%(default)s')",
|
|
104
|
-
)
|
|
105
|
-
|
|
106
83
|
|
|
84
|
+
@log_args_decorator
|
|
107
85
|
def run(args: argparse.Namespace) -> None:
|
|
108
86
|
"""Run sharpen subcommand.
|
|
109
87
|
|
|
@@ -113,7 +91,6 @@ def run(args: argparse.Namespace) -> None:
|
|
|
113
91
|
Returns:
|
|
114
92
|
None
|
|
115
93
|
"""
|
|
116
|
-
log.debug(args)
|
|
117
94
|
|
|
118
95
|
for image_path_str in args.image_paths:
|
|
119
96
|
with load_image(Path(image_path_str)) as original_image:
|
|
@@ -25,6 +25,7 @@ from PIL import Image, ImageColor, ImageDraw, ImageFont, ImageSequence
|
|
|
25
25
|
|
|
26
26
|
from fotolab import load_image, save_image
|
|
27
27
|
from fotolab.subcommands.info import get_formatted_camera_info
|
|
28
|
+
from .common import add_common_arguments, log_args_decorator
|
|
28
29
|
|
|
29
30
|
log: logging.Logger = logging.getLogger(__name__)
|
|
30
31
|
|
|
@@ -42,14 +43,7 @@ def build_subparser(subparsers: argparse._SubParsersAction) -> None:
|
|
|
42
43
|
|
|
43
44
|
watermark_parser.set_defaults(func=run)
|
|
44
45
|
|
|
45
|
-
watermark_parser
|
|
46
|
-
dest="image_paths",
|
|
47
|
-
help="set the image filenames",
|
|
48
|
-
nargs="+",
|
|
49
|
-
type=str,
|
|
50
|
-
default=None,
|
|
51
|
-
metavar="IMAGE_PATHS",
|
|
52
|
-
)
|
|
46
|
+
add_common_arguments(watermark_parser)
|
|
53
47
|
|
|
54
48
|
watermark_parser.add_argument(
|
|
55
49
|
"-t",
|
|
@@ -161,24 +155,8 @@ def build_subparser(subparsers: argparse._SubParsersAction) -> None:
|
|
|
161
155
|
help="lowercase the watermark text",
|
|
162
156
|
)
|
|
163
157
|
|
|
164
|
-
watermark_parser.add_argument(
|
|
165
|
-
"-op",
|
|
166
|
-
"--open",
|
|
167
|
-
default=False,
|
|
168
|
-
action="store_true",
|
|
169
|
-
dest="open",
|
|
170
|
-
help="open the image using default program (default: '%(default)s')",
|
|
171
|
-
)
|
|
172
|
-
|
|
173
|
-
watermark_parser.add_argument(
|
|
174
|
-
"-od",
|
|
175
|
-
"--output-dir",
|
|
176
|
-
dest="output_dir",
|
|
177
|
-
default="output",
|
|
178
|
-
help="set default output folder (default: '%(default)s')",
|
|
179
|
-
)
|
|
180
|
-
|
|
181
158
|
|
|
159
|
+
@log_args_decorator
|
|
182
160
|
def run(args: argparse.Namespace) -> None:
|
|
183
161
|
"""Run watermark subcommand.
|
|
184
162
|
|
|
@@ -188,7 +166,6 @@ def run(args: argparse.Namespace) -> None:
|
|
|
188
166
|
Returns:
|
|
189
167
|
None
|
|
190
168
|
"""
|
|
191
|
-
log.debug(args)
|
|
192
169
|
|
|
193
170
|
for image_path_str in args.image_paths:
|
|
194
171
|
try:
|
|
@@ -14,6 +14,7 @@ src/fotolab/subcommands/__init__.py
|
|
|
14
14
|
src/fotolab/subcommands/animate.py
|
|
15
15
|
src/fotolab/subcommands/auto.py
|
|
16
16
|
src/fotolab/subcommands/border.py
|
|
17
|
+
src/fotolab/subcommands/common.py
|
|
17
18
|
src/fotolab/subcommands/contrast.py
|
|
18
19
|
src/fotolab/subcommands/env.py
|
|
19
20
|
src/fotolab/subcommands/halftone.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|