fotolab 0.28.1__tar.gz → 0.28.2__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.28.1 → fotolab-0.28.2}/.pre-commit-config.yaml +1 -1
- {fotolab-0.28.1 → fotolab-0.28.2}/CHANGELOG.md +8 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/PKG-INFO +1 -1
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/__init__.py +1 -1
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/subcommands/border.py +39 -25
- {fotolab-0.28.1 → fotolab-0.28.2}/.coveragerc +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/.gitignore +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/.python-version +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/CONTRIBUTING.md +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/LICENSE.md +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/Pipfile +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/Pipfile.lock +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/README.md +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/docs/Makefile +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/docs/make.bat +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/docs/source/CHANGELOG.md +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/docs/source/CONTRIBUTING.md +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/docs/source/LICENSE.md +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/docs/source/README.md +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/docs/source/_static/logo.jpg +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/docs/source/conf.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/docs/source/index.rst +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/__main__.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/cli.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/subcommands/__init__.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/subcommands/animate.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/subcommands/auto.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/subcommands/contrast.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/subcommands/env.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/subcommands/halftone.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/subcommands/info.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/subcommands/montage.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/subcommands/resize.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/subcommands/rotate.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/subcommands/sharpen.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/fotolab/subcommands/watermark.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/noxfile.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/pyproject.toml +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/tests/__init__.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/tests/conftest.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/tests/test_env_subcommand.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/tests/test_help_flag.py +0 -0
- {fotolab-0.28.1 → fotolab-0.28.2}/tests/test_quiet_flag.py +0 -0
@@ -7,6 +7,14 @@ and this project adheres to [0-based versioning](https://0ver.org/).
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## v0.28.2 (2025-03-23)
|
11
|
+
|
12
|
+
- Accept width in integer instead of string
|
13
|
+
- Bump pre-commit hook for validate-project
|
14
|
+
- Handle file not found and other exceptions when opening/processing images
|
15
|
+
- Remove all unnecessary exceptions handling
|
16
|
+
- Use Union for border width return type to allow int or tuple
|
17
|
+
|
10
18
|
## v0.28.1 (2025-03-16)
|
11
19
|
|
12
20
|
- Add typehint to `_get_output_filename` function
|
@@ -17,6 +17,7 @@
|
|
17
17
|
|
18
18
|
import argparse
|
19
19
|
import logging
|
20
|
+
from typing import Tuple, Union
|
20
21
|
|
21
22
|
from PIL import Image, ImageColor, ImageOps
|
22
23
|
|
@@ -54,9 +55,9 @@ def build_subparser(subparsers) -> None:
|
|
54
55
|
"-w",
|
55
56
|
"--width",
|
56
57
|
dest="width",
|
57
|
-
type=
|
58
|
+
type=int,
|
58
59
|
default=10,
|
59
|
-
help="set the width of border (default: '%(default)s')",
|
60
|
+
help="set the width of border in pixels (default: '%(default)s')",
|
60
61
|
metavar="WIDTH",
|
61
62
|
)
|
62
63
|
|
@@ -64,9 +65,9 @@ def build_subparser(subparsers) -> None:
|
|
64
65
|
"-wt",
|
65
66
|
"--width-top",
|
66
67
|
dest="width_top",
|
67
|
-
type=
|
68
|
+
type=int,
|
68
69
|
default=0,
|
69
|
-
help="set the width of top border (default: '%(default)s')",
|
70
|
+
help="set the width of top border in pixels (default: '%(default)s')",
|
70
71
|
metavar="WIDTH",
|
71
72
|
)
|
72
73
|
|
@@ -74,9 +75,12 @@ def build_subparser(subparsers) -> None:
|
|
74
75
|
"-wr",
|
75
76
|
"--width-right",
|
76
77
|
dest="width_right",
|
77
|
-
type=
|
78
|
+
type=int,
|
78
79
|
default=0,
|
79
|
-
help=
|
80
|
+
help=(
|
81
|
+
"set the width of right border in pixels"
|
82
|
+
" (default: '%(default)s')"
|
83
|
+
),
|
80
84
|
metavar="WIDTH",
|
81
85
|
)
|
82
86
|
|
@@ -84,9 +88,12 @@ def build_subparser(subparsers) -> None:
|
|
84
88
|
"-wb",
|
85
89
|
"--width-bottom",
|
86
90
|
dest="width_bottom",
|
87
|
-
type=
|
91
|
+
type=int,
|
88
92
|
default=0,
|
89
|
-
help=
|
93
|
+
help=(
|
94
|
+
"set the width of bottom border in pixels"
|
95
|
+
" (default: '%(default)s')"
|
96
|
+
),
|
90
97
|
metavar="WIDTH",
|
91
98
|
)
|
92
99
|
|
@@ -94,9 +101,9 @@ def build_subparser(subparsers) -> None:
|
|
94
101
|
"-wl",
|
95
102
|
"--width-left",
|
96
103
|
dest="width_left",
|
97
|
-
type=
|
104
|
+
type=int,
|
98
105
|
default=0,
|
99
|
-
help="set the width of left border (default: '%(default)s')",
|
106
|
+
help="set the width of left border in pixels (default: '%(default)s')",
|
100
107
|
metavar="WIDTH",
|
101
108
|
)
|
102
109
|
|
@@ -130,27 +137,34 @@ def run(args: argparse.Namespace) -> None:
|
|
130
137
|
log.debug(args)
|
131
138
|
|
132
139
|
for image_filename in args.image_filenames:
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
140
|
+
try:
|
141
|
+
original_image = Image.open(image_filename)
|
142
|
+
border = get_border(args)
|
143
|
+
bordered_image = ImageOps.expand(
|
144
|
+
original_image,
|
145
|
+
border=border,
|
146
|
+
fill=ImageColor.getrgb(args.color),
|
147
|
+
)
|
148
|
+
except Exception as e:
|
149
|
+
log.error("Error adding border to %s: %s", image_filename, e)
|
150
|
+
continue
|
141
151
|
|
142
152
|
save_image(args, bordered_image, image_filename, "border")
|
143
153
|
|
144
154
|
|
145
|
-
def get_border(
|
155
|
+
def get_border(
|
156
|
+
args: argparse.Namespace,
|
157
|
+
) -> Union[Tuple[int, int, int, int], int]:
|
146
158
|
"""Calculate the border dimensions.
|
147
159
|
|
148
160
|
Args:
|
149
161
|
args (argparse.Namespace): Command line arguments
|
150
162
|
|
151
163
|
Returns:
|
152
|
-
|
153
|
-
widths are
|
164
|
+
Union[Tuple[int, int, int, int], int]: Border dimensions in pixels.
|
165
|
+
If individual widths are specified, returns a tuple of (left, top,
|
166
|
+
right, bottom) widths. Otherwise, returns a uniform width for all
|
167
|
+
sides.
|
154
168
|
"""
|
155
169
|
if any(
|
156
170
|
[
|
@@ -161,9 +175,9 @@ def get_border(args: argparse.Namespace) -> tuple[int, int, int, int]:
|
|
161
175
|
]
|
162
176
|
):
|
163
177
|
return (
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
178
|
+
args.width_left,
|
179
|
+
args.width_top,
|
180
|
+
args.width_right,
|
181
|
+
args.width_bottom,
|
168
182
|
)
|
169
183
|
return args.width
|
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
|
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
|