fotolab 0.19.0__py2.py3-none-any.whl → 0.20.1__py2.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 +1 -1
- fotolab/resize.py +17 -2
- {fotolab-0.19.0.dist-info → fotolab-0.20.1.dist-info}/METADATA +10 -7
- {fotolab-0.19.0.dist-info → fotolab-0.20.1.dist-info}/RECORD +7 -7
- {fotolab-0.19.0.dist-info → fotolab-0.20.1.dist-info}/LICENSE.md +0 -0
- {fotolab-0.19.0.dist-info → fotolab-0.20.1.dist-info}/WHEEL +0 -0
- {fotolab-0.19.0.dist-info → fotolab-0.20.1.dist-info}/entry_points.txt +0 -0
fotolab/__init__.py
CHANGED
fotolab/resize.py
CHANGED
@@ -20,7 +20,7 @@ import logging
|
|
20
20
|
import math
|
21
21
|
import sys
|
22
22
|
|
23
|
-
from PIL import Image
|
23
|
+
from PIL import Image, ImageColor
|
24
24
|
|
25
25
|
from fotolab import save_image
|
26
26
|
|
@@ -54,6 +54,17 @@ def build_subparser(subparsers) -> None:
|
|
54
54
|
help="paste image onto a larger canvas",
|
55
55
|
)
|
56
56
|
|
57
|
+
resize_parser.add_argument(
|
58
|
+
"-l",
|
59
|
+
"--canvas-color",
|
60
|
+
default="black",
|
61
|
+
dest="canvas_color",
|
62
|
+
help=(
|
63
|
+
"the color of the extended larger canvas"
|
64
|
+
"(default: '%(default)s')"
|
65
|
+
),
|
66
|
+
)
|
67
|
+
|
57
68
|
if "-c" in sys.argv or "--canvas" in sys.argv:
|
58
69
|
resize_parser.add_argument(
|
59
70
|
"-W",
|
@@ -119,7 +130,11 @@ def run(args: argparse.Namespace) -> None:
|
|
119
130
|
|
120
131
|
|
121
132
|
def _resize_image_onto_canvas(original_image, args):
|
122
|
-
resized_image = Image.new(
|
133
|
+
resized_image = Image.new(
|
134
|
+
"RGB",
|
135
|
+
(args.width, args.height),
|
136
|
+
(*ImageColor.getrgb(args.canvas_color), 128),
|
137
|
+
)
|
123
138
|
x_offset = (args.width - original_image.width) // 2
|
124
139
|
y_offset = (args.height - original_image.height) // 2
|
125
140
|
resized_image.paste(original_image, (x_offset, y_offset))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fotolab
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.20.1
|
4
4
|
Summary: A console program that manipulate images.
|
5
5
|
Keywords: photography,photo
|
6
6
|
Author-email: Kian-Meng Ang <kianmeng@cpan.org>
|
@@ -266,17 +266,20 @@ fotolab resize -h
|
|
266
266
|
<!--help-resize !-->
|
267
267
|
|
268
268
|
```console
|
269
|
-
usage: fotolab resize [-h] [-c] [-W WIDTH | -H HEIGHT]
|
269
|
+
usage: fotolab resize [-h] [-c] [-l CANVAS_COLOR] [-W WIDTH | -H HEIGHT]
|
270
270
|
IMAGE_FILENAMES [IMAGE_FILENAMES ...]
|
271
271
|
|
272
272
|
positional arguments:
|
273
|
-
IMAGE_FILENAMES
|
273
|
+
IMAGE_FILENAMES set the image filename
|
274
274
|
|
275
275
|
options:
|
276
|
-
-h, --help
|
277
|
-
-c, --canvas
|
278
|
-
-
|
279
|
-
|
276
|
+
-h, --help show this help message and exit
|
277
|
+
-c, --canvas paste image onto a larger canvas
|
278
|
+
-l, --canvas-color CANVAS_COLOR
|
279
|
+
the color of the extended larger canvas(default:
|
280
|
+
'black')
|
281
|
+
-W, --width WIDTH set the width of the image (default: '600')
|
282
|
+
-H, --height HEIGHT set the height of the image (default: '277')
|
280
283
|
```
|
281
284
|
|
282
285
|
<!--help-resize !-->
|
@@ -1,4 +1,4 @@
|
|
1
|
-
fotolab/__init__.py,sha256=
|
1
|
+
fotolab/__init__.py,sha256=kFjveIbYfTI8In7w4thI9J-nbyQVC61T8YF6KxxAJ3c,2061
|
2
2
|
fotolab/__main__.py,sha256=aboOURPs_snOXTEWYR0q8oq1UTY9e-NxCd1j33V0wHI,833
|
3
3
|
fotolab/animate.py,sha256=ejimhTozo9DN7BbqqcV4x8zLnanZRKq1pxBBFeOdr6Q,2967
|
4
4
|
fotolab/auto.py,sha256=l_-Kf5V5Anvwz1QV1ET-42YsDWEeHf_okHkXWOycWAI,2295
|
@@ -8,12 +8,12 @@ fotolab/contrast.py,sha256=l7Bs5p8W8ypN9Cg3fFHnU-A20UwMKtjTiPk6D0PRwpM,2095
|
|
8
8
|
fotolab/env.py,sha256=fzUoRWgYEiYJIWYEiiSLEb7dH_xVUOnhMpQgc1yjrTY,1457
|
9
9
|
fotolab/info.py,sha256=kbKMIqdkK-Wn2lWLvnFL_Efc45K9KCaR_euTv9LIGzw,2256
|
10
10
|
fotolab/montage.py,sha256=lUVY-zDSH7mwH-s34_XefdNp7CoDJHkwpbTUGiyJGgs,2037
|
11
|
-
fotolab/resize.py,sha256=
|
11
|
+
fotolab/resize.py,sha256=2bH1Kgoe_DqU8ozJ1E_oA6a9JPtuwIlo5a4sq_4Yles,5018
|
12
12
|
fotolab/rotate.py,sha256=l_vQgf0IcI8AR1TSVsk4PrMZtJ3j_wpU77rKiGJ-KTA,1715
|
13
13
|
fotolab/sharpen.py,sha256=wUPtJdtB6mCRmcHrA0CoEVO0O0ROBJWhejTvUeL67QU,2655
|
14
14
|
fotolab/watermark.py,sha256=zxmTT1k78tdqqzbRu13YVOFQ0Z1cKd7JHU4M0nV01DU,7418
|
15
|
-
fotolab-0.
|
16
|
-
fotolab-0.
|
17
|
-
fotolab-0.
|
18
|
-
fotolab-0.
|
19
|
-
fotolab-0.
|
15
|
+
fotolab-0.20.1.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
|
16
|
+
fotolab-0.20.1.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
17
|
+
fotolab-0.20.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
18
|
+
fotolab-0.20.1.dist-info/METADATA,sha256=GhF0LxtDve3dgZbjoKLf89Z4D-dPZQMUoXfSTwEoWiI,10576
|
19
|
+
fotolab-0.20.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|