fotolab 0.9.1__tar.gz → 0.10.0__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.9.1 → fotolab-0.10.0}/.pre-commit-config.yaml +1 -1
- {fotolab-0.9.1 → fotolab-0.10.0}/CHANGELOG.md +17 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/PKG-INFO +20 -4
- {fotolab-0.9.1 → fotolab-0.10.0}/Pipfile.lock +7 -7
- {fotolab-0.9.1 → fotolab-0.10.0}/README.md +19 -3
- {fotolab-0.9.1 → fotolab-0.10.0}/fotolab/__init__.py +6 -6
- {fotolab-0.9.1 → fotolab-0.10.0}/fotolab/border.py +1 -1
- {fotolab-0.9.1 → fotolab-0.10.0}/fotolab/cli.py +2 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/fotolab/contrast.py +1 -1
- fotolab-0.10.0/fotolab/info.py +58 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/fotolab/resize.py +1 -1
- {fotolab-0.9.1 → fotolab-0.10.0}/fotolab/sharpen.py +1 -1
- {fotolab-0.9.1 → fotolab-0.10.0}/fotolab/watermark.py +1 -1
- {fotolab-0.9.1 → fotolab-0.10.0}/.coveragerc +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/.gitignore +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/.python-version +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/CONTRIBUTING.md +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/LICENSE.md +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/Pipfile +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/docs/Makefile +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/docs/make.bat +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/docs/source/CHANGELOG.md +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/docs/source/CONTRIBUTING.md +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/docs/source/LICENSE.md +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/docs/source/README.md +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/docs/source/_static/logo.jpg +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/docs/source/conf.py +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/docs/source/index.rst +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/fotolab/__main__.py +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/fotolab/auto.py +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/fotolab/env.py +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/pyproject.toml +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/tests/__init__.py +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/tests/conftest.py +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/tests/test_env.py +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/tests/test_help_flag.py +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/tests/test_quiet_flag.py +0 -0
- {fotolab-0.9.1 → fotolab-0.10.0}/tox.ini +0 -0
@@ -7,6 +7,23 @@ and this project adheres to [0-based versioning](https://0ver.org/).
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## v0.10.0 (2024-03-31)
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Add `info` subcommand to show EXIF data from image
|
15
|
+
|
16
|
+
### Changed
|
17
|
+
|
18
|
+
- Bump deps
|
19
|
+
- Update help message in README
|
20
|
+
- Ignore `pylint` W0212 rule
|
21
|
+
|
22
|
+
### Fix
|
23
|
+
|
24
|
+
- Fix incorrect action in log when running `auto` subcommand
|
25
|
+
- Update incorrect comment for `save_image` helper function
|
26
|
+
|
10
27
|
## v0.9.1 (2024-03-24)
|
11
28
|
|
12
29
|
### Changed
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fotolab
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.10.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>
|
@@ -57,9 +57,8 @@ fotolab -h
|
|
57
57
|
```
|
58
58
|
|
59
59
|
```console
|
60
|
-
|
61
60
|
usage: fotolab [-h] [-o] [-op] [-od OUTPUT_DIR] [-q] [-d] [-V]
|
62
|
-
{auto,border,contrast,resize,sharpen,watermark,env} ...
|
61
|
+
{auto,border,contrast,info,resize,sharpen,watermark,env} ...
|
63
62
|
|
64
63
|
A console program to manipulate photos.
|
65
64
|
|
@@ -68,11 +67,12 @@ A console program to manipulate photos.
|
|
68
67
|
issues: https://github.com/kianmeng/fotolab/issues
|
69
68
|
|
70
69
|
positional arguments:
|
71
|
-
{auto,border,contrast,resize,sharpen,watermark,env}
|
70
|
+
{auto,border,contrast,info,resize,sharpen,watermark,env}
|
72
71
|
sub-command help
|
73
72
|
auto auto adjust (resize, contrast, and watermark) a photo
|
74
73
|
border add border to image
|
75
74
|
contrast contrast an image
|
75
|
+
info info an image
|
76
76
|
resize resize an image
|
77
77
|
sharpen sharpen an image
|
78
78
|
watermark watermark an image
|
@@ -135,6 +135,22 @@ optional arguments:
|
|
135
135
|
-h, --help show this help message and exit
|
136
136
|
```
|
137
137
|
|
138
|
+
### fotolab info
|
139
|
+
|
140
|
+
```console
|
141
|
+
fotolab info -h
|
142
|
+
```
|
143
|
+
|
144
|
+
```console
|
145
|
+
usage: fotolab info [-h] IMAGE_FILENAME
|
146
|
+
|
147
|
+
positional arguments:
|
148
|
+
IMAGE_FILENAME set the image filename
|
149
|
+
|
150
|
+
optional arguments:
|
151
|
+
-h, --help show this help message and exit
|
152
|
+
```
|
153
|
+
|
138
154
|
### fotolab sharpen
|
139
155
|
|
140
156
|
```console
|
@@ -196,11 +196,11 @@
|
|
196
196
|
},
|
197
197
|
"filelock": {
|
198
198
|
"hashes": [
|
199
|
-
"sha256:
|
200
|
-
"sha256:
|
199
|
+
"sha256:5ffa845303983e7a0b7ae17636509bc97997d58afeafa72fb141a17b152284cb",
|
200
|
+
"sha256:a79895a25bbefdf55d1a2a0a80968f7dbb28edcd6d4234a0afb3f37ecde4b546"
|
201
201
|
],
|
202
202
|
"markers": "python_version >= '3.8'",
|
203
|
-
"version": "==3.13.
|
203
|
+
"version": "==3.13.3"
|
204
204
|
},
|
205
205
|
"flake8": {
|
206
206
|
"hashes": [
|
@@ -450,12 +450,12 @@
|
|
450
450
|
},
|
451
451
|
"pytest-cov": {
|
452
452
|
"hashes": [
|
453
|
-
"sha256:
|
454
|
-
"sha256:
|
453
|
+
"sha256:4f0764a1219df53214206bf1feea4633c3b558a2925c8b59f144f682861ce652",
|
454
|
+
"sha256:5837b58e9f6ebd335b0f8060eecce69b662415b16dc503883a02f45dfeb14857"
|
455
455
|
],
|
456
456
|
"index": "pypi",
|
457
|
-
"markers": "python_version >= '3.
|
458
|
-
"version": "==
|
457
|
+
"markers": "python_version >= '3.8'",
|
458
|
+
"version": "==5.0.0"
|
459
459
|
},
|
460
460
|
"pytest-randomly": {
|
461
461
|
"hashes": [
|
@@ -35,9 +35,8 @@ fotolab -h
|
|
35
35
|
```
|
36
36
|
|
37
37
|
```console
|
38
|
-
|
39
38
|
usage: fotolab [-h] [-o] [-op] [-od OUTPUT_DIR] [-q] [-d] [-V]
|
40
|
-
{auto,border,contrast,resize,sharpen,watermark,env} ...
|
39
|
+
{auto,border,contrast,info,resize,sharpen,watermark,env} ...
|
41
40
|
|
42
41
|
A console program to manipulate photos.
|
43
42
|
|
@@ -46,11 +45,12 @@ A console program to manipulate photos.
|
|
46
45
|
issues: https://github.com/kianmeng/fotolab/issues
|
47
46
|
|
48
47
|
positional arguments:
|
49
|
-
{auto,border,contrast,resize,sharpen,watermark,env}
|
48
|
+
{auto,border,contrast,info,resize,sharpen,watermark,env}
|
50
49
|
sub-command help
|
51
50
|
auto auto adjust (resize, contrast, and watermark) a photo
|
52
51
|
border add border to image
|
53
52
|
contrast contrast an image
|
53
|
+
info info an image
|
54
54
|
resize resize an image
|
55
55
|
sharpen sharpen an image
|
56
56
|
watermark watermark an image
|
@@ -113,6 +113,22 @@ optional arguments:
|
|
113
113
|
-h, --help show this help message and exit
|
114
114
|
```
|
115
115
|
|
116
|
+
### fotolab info
|
117
|
+
|
118
|
+
```console
|
119
|
+
fotolab info -h
|
120
|
+
```
|
121
|
+
|
122
|
+
```console
|
123
|
+
usage: fotolab info [-h] IMAGE_FILENAME
|
124
|
+
|
125
|
+
positional arguments:
|
126
|
+
IMAGE_FILENAME set the image filename
|
127
|
+
|
128
|
+
optional arguments:
|
129
|
+
-h, --help show this help message and exit
|
130
|
+
```
|
131
|
+
|
116
132
|
### fotolab sharpen
|
117
133
|
|
118
134
|
```console
|
@@ -21,22 +21,22 @@ import subprocess
|
|
21
21
|
import sys
|
22
22
|
from pathlib import Path
|
23
23
|
|
24
|
-
__version__ = "0.
|
24
|
+
__version__ = "0.10.0"
|
25
25
|
|
26
26
|
log = logging.getLogger(__name__)
|
27
27
|
|
28
28
|
|
29
|
-
def save_image(args, new_image):
|
30
|
-
"""
|
29
|
+
def save_image(args, new_image, subcommand):
|
30
|
+
"""Save image after image operation.
|
31
31
|
|
32
32
|
Args:
|
33
33
|
args (argparse.Namespace): Config from command line arguments
|
34
34
|
new_image(PIL.Image.Image): Modified image
|
35
|
+
subcommand(str): Subcommand used to call this function
|
35
36
|
|
36
37
|
Returns:
|
37
38
|
None
|
38
39
|
"""
|
39
|
-
action = args.func.__module__.split(".")[-1]
|
40
40
|
image_file = Path(args.image_filename)
|
41
41
|
|
42
42
|
if args.overwrite:
|
@@ -44,11 +44,11 @@ def save_image(args, new_image):
|
|
44
44
|
else:
|
45
45
|
new_filename = Path(
|
46
46
|
args.output_dir,
|
47
|
-
image_file.with_name(f"{
|
47
|
+
image_file.with_name(f"{subcommand}_{image_file.name}"),
|
48
48
|
)
|
49
49
|
new_filename.parent.mkdir(parents=True, exist_ok=True)
|
50
50
|
|
51
|
-
log.info("%s image: %s",
|
51
|
+
log.info("%s image: %s", subcommand, new_filename)
|
52
52
|
new_image.save(new_filename)
|
53
53
|
|
54
54
|
if args.open:
|
@@ -29,6 +29,7 @@ import fotolab.auto
|
|
29
29
|
import fotolab.border
|
30
30
|
import fotolab.contrast
|
31
31
|
import fotolab.env
|
32
|
+
import fotolab.info
|
32
33
|
import fotolab.resize
|
33
34
|
import fotolab.sharpen
|
34
35
|
import fotolab.watermark
|
@@ -122,6 +123,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
122
123
|
fotolab.auto.build_subparser(subparsers)
|
123
124
|
fotolab.border.build_subparser(subparsers)
|
124
125
|
fotolab.contrast.build_subparser(subparsers)
|
126
|
+
fotolab.info.build_subparser(subparsers)
|
125
127
|
fotolab.resize.build_subparser(subparsers)
|
126
128
|
fotolab.sharpen.build_subparser(subparsers)
|
127
129
|
fotolab.watermark.build_subparser(subparsers)
|
@@ -0,0 +1,58 @@
|
|
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
|
+
"""Info subcommand."""
|
17
|
+
|
18
|
+
import argparse
|
19
|
+
import logging
|
20
|
+
|
21
|
+
from PIL import ExifTags, Image
|
22
|
+
|
23
|
+
log = logging.getLogger(__name__)
|
24
|
+
|
25
|
+
|
26
|
+
def build_subparser(subparsers) -> None:
|
27
|
+
"""Build the subparser."""
|
28
|
+
info_parser = subparsers.add_parser("info", help="info an image")
|
29
|
+
|
30
|
+
info_parser.set_defaults(func=run)
|
31
|
+
|
32
|
+
info_parser.add_argument(
|
33
|
+
dest="image_filename",
|
34
|
+
help="set the image filename",
|
35
|
+
type=str,
|
36
|
+
default=None,
|
37
|
+
metavar="IMAGE_FILENAME",
|
38
|
+
)
|
39
|
+
|
40
|
+
|
41
|
+
def run(args: argparse.Namespace) -> None:
|
42
|
+
"""Run info subcommand.
|
43
|
+
|
44
|
+
Args:
|
45
|
+
config (argparse.Namespace): Config from command line arguments
|
46
|
+
|
47
|
+
Returns:
|
48
|
+
None
|
49
|
+
"""
|
50
|
+
log.debug(args)
|
51
|
+
|
52
|
+
image = Image.open(args.image_filename)
|
53
|
+
exif = image._getexif()
|
54
|
+
info = {ExifTags.TAGS.get(tag_id): exif.get(tag_id) for tag_id in exif}
|
55
|
+
|
56
|
+
tag_name_width = max(map(len, info))
|
57
|
+
for tag_name, tag_value in info.items():
|
58
|
+
print(f"{tag_name:<{tag_name_width}}: {tag_value}")
|
@@ -145,7 +145,7 @@ def run(args: argparse.Namespace) -> None:
|
|
145
145
|
stroke_fill=ImageColor.getrgb(args.outline_color),
|
146
146
|
)
|
147
147
|
|
148
|
-
save_image(args, watermarked_image)
|
148
|
+
save_image(args, watermarked_image, "watermark")
|
149
149
|
|
150
150
|
|
151
151
|
def calculate_position(image, text_width, text_height, position) -> tuple:
|
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
|