fotolab 0.2.0__py2.py3-none-any.whl → 0.3.0__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/border.py +54 -0
- fotolab/cli.py +2 -0
- fotolab/env.py +1 -1
- fotolab/watermark.py +1 -1
- {fotolab-0.2.0.dist-info → fotolab-0.3.0.dist-info}/METADATA +22 -4
- fotolab-0.3.0.dist-info/RECORD +11 -0
- fotolab-0.2.0.dist-info/RECORD +0 -10
- {fotolab-0.2.0.dist-info → fotolab-0.3.0.dist-info}/LICENSE.md +0 -0
- {fotolab-0.2.0.dist-info → fotolab-0.3.0.dist-info}/WHEEL +0 -0
- {fotolab-0.2.0.dist-info → fotolab-0.3.0.dist-info}/entry_points.txt +0 -0
fotolab/__init__.py
CHANGED
fotolab/border.py
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright (C) 2024 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
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
6
|
+
# later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
10
|
+
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
11
|
+
# details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Affero General Public License
|
14
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
"""Border subcommand."""
|
17
|
+
|
18
|
+
import argparse
|
19
|
+
import logging
|
20
|
+
from pathlib import Path
|
21
|
+
|
22
|
+
from PIL import Image, ImageColor, ImageOps
|
23
|
+
|
24
|
+
log = logging.getLogger(__name__)
|
25
|
+
|
26
|
+
|
27
|
+
def build_subparser(subparsers) -> None:
|
28
|
+
"""Build the subparser."""
|
29
|
+
border_parser = subparsers.add_parser("border", help="add border to image")
|
30
|
+
|
31
|
+
border_parser.set_defaults(func=run)
|
32
|
+
|
33
|
+
border_parser.add_argument(
|
34
|
+
dest="image_filename",
|
35
|
+
help="set the image filename",
|
36
|
+
type=str,
|
37
|
+
default=None,
|
38
|
+
metavar="IMAGE_FILENAME",
|
39
|
+
)
|
40
|
+
|
41
|
+
|
42
|
+
def run(args: argparse.Namespace) -> None:
|
43
|
+
"""Run border subcommand."""
|
44
|
+
log.debug(args)
|
45
|
+
|
46
|
+
image_file = Path(args.image_filename)
|
47
|
+
|
48
|
+
original_image = Image.open(args.image_filename)
|
49
|
+
bordered_image = original_image.copy()
|
50
|
+
|
51
|
+
ImageOps.expand(bordered_image, border=5, fill=ImageColor.getrgb("black"))
|
52
|
+
|
53
|
+
new_filename = image_file.with_name(f"border_{image_file.name}")
|
54
|
+
bordered_image.save(new_filename)
|
fotolab/cli.py
CHANGED
@@ -25,6 +25,7 @@ import logging
|
|
25
25
|
import sys
|
26
26
|
from typing import Dict, Optional, Sequence
|
27
27
|
|
28
|
+
import fotolab.border
|
28
29
|
import fotolab.env
|
29
30
|
import fotolab.watermark
|
30
31
|
from fotolab import __version__
|
@@ -88,6 +89,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
88
89
|
)
|
89
90
|
|
90
91
|
subparsers = parser.add_subparsers(help="sub-command help")
|
92
|
+
fotolab.border.build_subparser(subparsers)
|
91
93
|
fotolab.watermark.build_subparser(subparsers)
|
92
94
|
fotolab.env.build_subparser(subparsers)
|
93
95
|
|
fotolab/env.py
CHANGED
fotolab/watermark.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fotolab
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.3.0
|
4
4
|
Summary: A console program that manipulate images.
|
5
5
|
Keywords: photography,photo
|
6
6
|
Author-email: Kian-Meng Ang <kianmeng@cpan.org>
|
@@ -51,7 +51,8 @@ fotolab -h
|
|
51
51
|
```
|
52
52
|
|
53
53
|
```console
|
54
|
-
|
54
|
+
|
55
|
+
usage: fotolab [-h] [-q] [-d] [-V] {border,watermark,env} ...
|
55
56
|
|
56
57
|
A console program to manipulate photos.
|
57
58
|
|
@@ -60,10 +61,11 @@ A console program to manipulate photos.
|
|
60
61
|
issues: https://github.com/kianmeng/fotolab/issues
|
61
62
|
|
62
63
|
positional arguments:
|
63
|
-
{
|
64
|
+
{border,watermark,env}
|
64
65
|
sub-command help
|
65
|
-
|
66
|
+
border add border to image
|
66
67
|
watermark watermark an image
|
68
|
+
env print environment information for bug reporting
|
67
69
|
|
68
70
|
options:
|
69
71
|
-h, --help show this help message and exit
|
@@ -72,6 +74,22 @@ options:
|
|
72
74
|
-V, --version show program's version number and exit
|
73
75
|
```
|
74
76
|
|
77
|
+
### fotolab border
|
78
|
+
|
79
|
+
```console
|
80
|
+
fotolab border -h
|
81
|
+
```
|
82
|
+
|
83
|
+
```console
|
84
|
+
usage: fotolab border [-h] IMAGE_FILENAME
|
85
|
+
|
86
|
+
positional arguments:
|
87
|
+
IMAGE_FILENAME set the image filename
|
88
|
+
|
89
|
+
options:
|
90
|
+
-h, --help show this help message and exit
|
91
|
+
```
|
92
|
+
|
75
93
|
### fotolab watermark
|
76
94
|
|
77
95
|
```console
|
@@ -0,0 +1,11 @@
|
|
1
|
+
fotolab/__init__.py,sha256=AwI4bRiHBa13gQtV77Wx67qDBiG_AuHZX8lh1gGd_fQ,764
|
2
|
+
fotolab/__main__.py,sha256=aboOURPs_snOXTEWYR0q8oq1UTY9e-NxCd1j33V0wHI,833
|
3
|
+
fotolab/border.py,sha256=24H3d1iaADrkPq3vy1NRZZE6T_9Z2V7TkpNPz25LT9o,1660
|
4
|
+
fotolab/cli.py,sha256=EquHxB7hanS82YZFxBwMkKjtzKQTF2nuNzMzhVUONXg,3561
|
5
|
+
fotolab/env.py,sha256=l1e39BJduaAqkg2cmrpInDE9pXXODLsmoWmhrhFf9Sc,1285
|
6
|
+
fotolab/watermark.py,sha256=35QCGqNdjDlRWmXfgLy06VqtMac5XaHDHUmJ0nq8lXA,4642
|
7
|
+
fotolab-0.3.0.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
|
8
|
+
fotolab-0.3.0.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
9
|
+
fotolab-0.3.0.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
10
|
+
fotolab-0.3.0.dist-info/METADATA,sha256=R3qFRJ4sPkeWR67DTvi0C0qTa1JKYaEcbMbLZHBrJkg,4847
|
11
|
+
fotolab-0.3.0.dist-info/RECORD,,
|
fotolab-0.2.0.dist-info/RECORD
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
fotolab/__init__.py,sha256=moOMEp9P2vNlAKT8V30Vit_OndDmQHNmeFpYJuzNj5M,764
|
2
|
-
fotolab/__main__.py,sha256=aboOURPs_snOXTEWYR0q8oq1UTY9e-NxCd1j33V0wHI,833
|
3
|
-
fotolab/cli.py,sha256=OvXn4w4HQ77-H0wRqbDCssRbxfNu5LE-OE82xLc1284,3492
|
4
|
-
fotolab/env.py,sha256=LDY3uQwF6MwBc1uxBZBDPgn2TqQu-Zz7lQAwwvToHxM,1286
|
5
|
-
fotolab/watermark.py,sha256=RGUEHFI-V1k3rv2wQES1ohIKs0rqns2AhDda1E0JkSE,4643
|
6
|
-
fotolab-0.2.0.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
|
7
|
-
fotolab-0.2.0.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
8
|
-
fotolab-0.2.0.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
9
|
-
fotolab-0.2.0.dist-info/METADATA,sha256=zZclokAyTqjF2KsJmWDYd4RAAN_1XTNCfWxGGnVTYME,4558
|
10
|
-
fotolab-0.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|