fotolab 0.24.0__py3-none-any.whl → 0.25.1__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 +2 -2
- fotolab/cli.py +1 -1
- fotolab/subcommands/__init__.py +1 -1
- fotolab/subcommands/animate.py +1 -1
- fotolab/subcommands/auto.py +2 -1
- fotolab/subcommands/border.py +20 -17
- fotolab/subcommands/contrast.py +1 -1
- fotolab/subcommands/env.py +1 -1
- fotolab/subcommands/info.py +1 -2
- fotolab/subcommands/montage.py +4 -4
- fotolab/subcommands/resize.py +1 -1
- fotolab/subcommands/rotate.py +1 -1
- fotolab/subcommands/sharpen.py +40 -3
- fotolab/subcommands/watermark.py +1 -1
- {fotolab-0.24.0.dist-info → fotolab-0.25.1.dist-info}/METADATA +4 -3
- fotolab-0.25.1.dist-info/RECORD +20 -0
- fotolab-0.24.0.dist-info/RECORD +0 -20
- {fotolab-0.24.0.dist-info → fotolab-0.25.1.dist-info}/LICENSE.md +0 -0
- {fotolab-0.24.0.dist-info → fotolab-0.25.1.dist-info}/WHEEL +0 -0
- {fotolab-0.24.0.dist-info → fotolab-0.25.1.dist-info}/entry_points.txt +0 -0
fotolab/__init__.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2024 Kian-Meng Ang
|
1
|
+
# Copyright (C) 2024,2025 Kian-Meng Ang
|
2
2
|
#
|
3
3
|
# This program is free software: you can redistribute it and/or modify it under
|
4
4
|
# the terms of the GNU Affero General Public License as published by the Free
|
@@ -21,7 +21,7 @@ import subprocess
|
|
21
21
|
import sys
|
22
22
|
from pathlib import Path
|
23
23
|
|
24
|
-
__version__ = "0.
|
24
|
+
__version__ = "0.25.1"
|
25
25
|
|
26
26
|
log = logging.getLogger(__name__)
|
27
27
|
|
fotolab/cli.py
CHANGED
fotolab/subcommands/__init__.py
CHANGED
fotolab/subcommands/animate.py
CHANGED
fotolab/subcommands/auto.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2024 Kian-Meng Ang
|
1
|
+
# Copyright (C) 2024,2025 Kian-Meng Ang
|
2
2
|
#
|
3
3
|
# This program is free software: you can redistribute it and/or modify it under
|
4
4
|
# the terms of the GNU Affero General Public License as published by the Free
|
@@ -70,6 +70,7 @@ def run(args: argparse.Namespace) -> None:
|
|
70
70
|
"camera": False,
|
71
71
|
"canvas": False,
|
72
72
|
"lowercase": False,
|
73
|
+
"before_after": False,
|
73
74
|
}
|
74
75
|
combined_args = argparse.Namespace(**vars(args), **extra_args)
|
75
76
|
combined_args.overwrite = True
|
fotolab/subcommands/border.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2024 Kian-Meng Ang
|
1
|
+
# Copyright (C) 2024,2025 Kian-Meng Ang
|
2
2
|
#
|
3
3
|
# This program is free software: you can redistribute it and/or modify it under
|
4
4
|
# the terms of the GNU Affero General Public License as published by the Free
|
@@ -115,25 +115,28 @@ def run(args: argparse.Namespace) -> None:
|
|
115
115
|
for image_filename in args.image_filenames:
|
116
116
|
original_image = Image.open(image_filename)
|
117
117
|
|
118
|
-
|
119
|
-
args.width_left
|
120
|
-
or args.width_top
|
121
|
-
or args.width_right
|
122
|
-
or args.width_bottom
|
123
|
-
):
|
124
|
-
border = (
|
125
|
-
int(args.width_left),
|
126
|
-
int(args.width_top),
|
127
|
-
int(args.width_right),
|
128
|
-
int(args.width_bottom),
|
129
|
-
)
|
130
|
-
else:
|
131
|
-
border = args.width
|
132
|
-
|
118
|
+
border = get_border(args)
|
133
119
|
bordered_image = ImageOps.expand(
|
134
120
|
original_image,
|
135
121
|
border=border,
|
136
122
|
fill=ImageColor.getrgb(args.color),
|
137
123
|
)
|
138
124
|
|
139
|
-
save_image(args, bordered_image, image_filename, "
|
125
|
+
save_image(args, bordered_image, image_filename, "border")
|
126
|
+
|
127
|
+
|
128
|
+
def get_border(args: argparse.Namespace) -> tuple:
|
129
|
+
"""Calculate the border."""
|
130
|
+
if (
|
131
|
+
args.width_left
|
132
|
+
or args.width_top
|
133
|
+
or args.width_right
|
134
|
+
or args.width_bottom
|
135
|
+
):
|
136
|
+
return (
|
137
|
+
int(args.width_left),
|
138
|
+
int(args.width_top),
|
139
|
+
int(args.width_right),
|
140
|
+
int(args.width_bottom),
|
141
|
+
)
|
142
|
+
return args.width
|
fotolab/subcommands/contrast.py
CHANGED
fotolab/subcommands/env.py
CHANGED
fotolab/subcommands/info.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2024 Kian-Meng Ang
|
1
|
+
# Copyright (C) 2024,2025 Kian-Meng Ang
|
2
2
|
#
|
3
3
|
# This program is free software: you can redistribute it and/or modify it under
|
4
4
|
# the terms of the GNU Affero General Public License as published by the Free
|
@@ -97,7 +97,6 @@ def run(args: argparse.Namespace) -> None:
|
|
97
97
|
|
98
98
|
def extract_exif_tags(image: Image.Image, sort: bool = False) -> dict:
|
99
99
|
"""Extract Exif metadata from image."""
|
100
|
-
print(type(image))
|
101
100
|
exif = image._getexif()
|
102
101
|
log.debug(exif)
|
103
102
|
|
fotolab/subcommands/montage.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2024 Kian-Meng Ang
|
1
|
+
# Copyright (C) 2024,2025 Kian-Meng Ang
|
2
2
|
#
|
3
3
|
# This program is free software: you can redistribute it and/or modify it under
|
4
4
|
# the terms of the GNU Affero General Public License as published by the Free
|
@@ -63,9 +63,9 @@ def run(args: argparse.Namespace) -> None:
|
|
63
63
|
montaged_image = Image.new("RGB", (total_width, total_height))
|
64
64
|
|
65
65
|
x_offset = 0
|
66
|
-
for
|
67
|
-
montaged_image.paste(
|
68
|
-
x_offset +=
|
66
|
+
for image in images:
|
67
|
+
montaged_image.paste(image, (x_offset, 0))
|
68
|
+
x_offset += image.width
|
69
69
|
|
70
70
|
output_image_filename = args.image_filenames[0].name
|
71
71
|
save_image(args, montaged_image, output_image_filename, "montage")
|
fotolab/subcommands/resize.py
CHANGED
fotolab/subcommands/rotate.py
CHANGED
fotolab/subcommands/sharpen.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2024 Kian-Meng Ang
|
1
|
+
# Copyright (C) 2024,2025 Kian-Meng Ang
|
2
2
|
#
|
3
3
|
# This program is free software: you can redistribute it and/or modify it under
|
4
4
|
# the terms of the GNU Affero General Public License as published by the Free
|
@@ -17,10 +17,11 @@
|
|
17
17
|
|
18
18
|
import argparse
|
19
19
|
import logging
|
20
|
+
from pathlib import Path
|
20
21
|
|
21
22
|
from PIL import Image, ImageFilter
|
22
23
|
|
23
|
-
from fotolab import save_image
|
24
|
+
from fotolab import _open_image, save_image
|
24
25
|
|
25
26
|
log = logging.getLogger(__name__)
|
26
27
|
|
@@ -76,6 +77,15 @@ def build_subparser(subparsers) -> None:
|
|
76
77
|
metavar="THRESHOLD",
|
77
78
|
)
|
78
79
|
|
80
|
+
sharpen_parser.add_argument(
|
81
|
+
"-ba",
|
82
|
+
"--before-after",
|
83
|
+
default=False,
|
84
|
+
action="store_true",
|
85
|
+
dest="before_after",
|
86
|
+
help="generate a GIF showing before and after changes",
|
87
|
+
)
|
88
|
+
|
79
89
|
|
80
90
|
def run(args: argparse.Namespace) -> None:
|
81
91
|
"""Run sharpen subcommand.
|
@@ -95,4 +105,31 @@ def run(args: argparse.Namespace) -> None:
|
|
95
105
|
args.radius, percent=args.percent, threshold=args.threshold
|
96
106
|
)
|
97
107
|
)
|
98
|
-
|
108
|
+
if args.before_after:
|
109
|
+
save_gif_image(args, image_filename, original_image, sharpen_image)
|
110
|
+
else:
|
111
|
+
save_image(args, sharpen_image, image_filename, "sharpen")
|
112
|
+
|
113
|
+
|
114
|
+
def save_gif_image(args, image_filename, original_image, sharpen_image):
|
115
|
+
"""Save the original and sharpen image."""
|
116
|
+
image_file = Path(image_filename)
|
117
|
+
new_filename = Path(
|
118
|
+
args.output_dir,
|
119
|
+
image_file.with_name(f"sharpen_gif_{image_file.stem}.gif"),
|
120
|
+
)
|
121
|
+
new_filename.parent.mkdir(parents=True, exist_ok=True)
|
122
|
+
|
123
|
+
log.info("sharpen gif image: %s", new_filename)
|
124
|
+
original_image.save(
|
125
|
+
new_filename,
|
126
|
+
format="gif",
|
127
|
+
append_images=[sharpen_image],
|
128
|
+
save_all=True,
|
129
|
+
duration=2500,
|
130
|
+
loop=0,
|
131
|
+
optimize=True,
|
132
|
+
)
|
133
|
+
|
134
|
+
if args.open:
|
135
|
+
_open_image(new_filename)
|
fotolab/subcommands/watermark.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fotolab
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.25.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>
|
@@ -300,7 +300,7 @@ fotolab sharpen -h
|
|
300
300
|
<!--help-sharpen !-->
|
301
301
|
|
302
302
|
```console
|
303
|
-
usage: fotolab sharpen [-h] [-r RADIUS] [-p PERCENT] [-t THRESHOLD]
|
303
|
+
usage: fotolab sharpen [-h] [-r RADIUS] [-p PERCENT] [-t THRESHOLD] [-ba]
|
304
304
|
IMAGE_FILENAMES [IMAGE_FILENAMES ...]
|
305
305
|
|
306
306
|
positional arguments:
|
@@ -315,6 +315,7 @@ options:
|
|
315
315
|
-t, --threshold THRESHOLD
|
316
316
|
set the minimum brightness changed to be sharpened
|
317
317
|
(default: '3')
|
318
|
+
-ba, --before-after generate a GIF showing before and after changes
|
318
319
|
```
|
319
320
|
|
320
321
|
<!--help-sharpen !-->
|
@@ -385,7 +386,7 @@ options:
|
|
385
386
|
|
386
387
|
## Copyright and License
|
387
388
|
|
388
|
-
Copyright (C) 2024 Kian-Meng Ang
|
389
|
+
Copyright (C) 2024,2025 Kian-Meng Ang
|
389
390
|
|
390
391
|
This program is free software: you can redistribute it and/or modify it under
|
391
392
|
the terms of the GNU Affero General Public License as published by the Free
|
@@ -0,0 +1,20 @@
|
|
1
|
+
fotolab/__init__.py,sha256=VQ7SOkbn3y2Pp5mPmk4P5E7_pFuSvOSW_dASQpdxOCQ,2066
|
2
|
+
fotolab/__main__.py,sha256=aboOURPs_snOXTEWYR0q8oq1UTY9e-NxCd1j33V0wHI,833
|
3
|
+
fotolab/cli.py,sha256=9rhS-yhX1nE_zKBfR05QyEt-S7Y43mIP0yUQA6bsgV8,4326
|
4
|
+
fotolab/subcommands/__init__.py,sha256=l3DlIaJ3u3jGjnC1H1yV8LZ_nPqOLJ6gikD4BCaMAQ0,1129
|
5
|
+
fotolab/subcommands/animate.py,sha256=Zp0LPM7ktg6V2rIAP8pof2mmPAph_0O3TEySvg55-h8,2972
|
6
|
+
fotolab/subcommands/auto.py,sha256=p_e1f4mcrIFLqBXMNKvPQRDkNrAlK7FR6sdR5NAR0t8,2427
|
7
|
+
fotolab/subcommands/border.py,sha256=v5rdLb7Yq1kQI0MTSfVb0iroBroTV8oxOk-jMLB2who,3637
|
8
|
+
fotolab/subcommands/contrast.py,sha256=8uPCd5xI-aUsL7rjdEPmfSskdzMwM-1tv0eRRONkW2M,2100
|
9
|
+
fotolab/subcommands/env.py,sha256=JamU3a2xWPbwlAj5iThHs58KYkLmjpUphZfTQODBp_4,1471
|
10
|
+
fotolab/subcommands/info.py,sha256=DANbfBNy2SzFfeE4KqOViAZkaME6xujfZvJTHIaZyCY,3312
|
11
|
+
fotolab/subcommands/montage.py,sha256=hhRH9LsWxXa86_qtVDKGvk--Eap2nP17OTy81kq3Xjk,2048
|
12
|
+
fotolab/subcommands/resize.py,sha256=d2Nlslzlvri9L2rqmE-HbmnLozylSk3U1Hi3DF1q3Mc,5023
|
13
|
+
fotolab/subcommands/rotate.py,sha256=vhtiAD5r0i5humpjyAbkoxh2nQsSuBYUD-TgcECwUwE,2149
|
14
|
+
fotolab/subcommands/sharpen.py,sha256=xz8RW8cRPM4eUvJTO1Stsur3G67DBftVGza8kF5j2Pc,3700
|
15
|
+
fotolab/subcommands/watermark.py,sha256=zKIFMreqSRaTD89JPjtLZljfTw-5ZkbZNBAyLeFveGw,8905
|
16
|
+
fotolab-0.25.1.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
|
17
|
+
fotolab-0.25.1.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
18
|
+
fotolab-0.25.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
19
|
+
fotolab-0.25.1.dist-info/METADATA,sha256=SOBJC9BClYTSg61YN6SmVbIOSn6NB4qpegx7cNBj7pY,11058
|
20
|
+
fotolab-0.25.1.dist-info/RECORD,,
|
fotolab-0.24.0.dist-info/RECORD
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
fotolab/__init__.py,sha256=xMgr0qY4XC9waGeCumA3xk1SjuwsIC0tuMY3k_u0suU,2061
|
2
|
-
fotolab/__main__.py,sha256=aboOURPs_snOXTEWYR0q8oq1UTY9e-NxCd1j33V0wHI,833
|
3
|
-
fotolab/cli.py,sha256=vUS7eVcwEy2CWn4g5wTujLXS_GAzug9Np7j8-sM6GHU,4321
|
4
|
-
fotolab/subcommands/__init__.py,sha256=5ncuu_LxuWphjNohm32Z_lD0FmJPWrAynBzeza0lyCU,1124
|
5
|
-
fotolab/subcommands/animate.py,sha256=ejimhTozo9DN7BbqqcV4x8zLnanZRKq1pxBBFeOdr6Q,2967
|
6
|
-
fotolab/subcommands/auto.py,sha256=ljvC0Z88Dva18YHyn3auAjlvVHqGrxsky-HGXwaIMZo,2391
|
7
|
-
fotolab/subcommands/border.py,sha256=5ch2d7LVPhB2OFuuXSW5ci6Cn967CPDQu0qSfaO7uMg,3591
|
8
|
-
fotolab/subcommands/contrast.py,sha256=l7Bs5p8W8ypN9Cg3fFHnU-A20UwMKtjTiPk6D0PRwpM,2095
|
9
|
-
fotolab/subcommands/env.py,sha256=6vQDQ1sunJl2XBaSAHpLZUOiKiHy4STO45CMjXJd_Ow,1466
|
10
|
-
fotolab/subcommands/info.py,sha256=vDzomRfHOKCNk9TON5CX9UB_km6GYBJT_nkDcwtARVA,3330
|
11
|
-
fotolab/subcommands/montage.py,sha256=lUVY-zDSH7mwH-s34_XefdNp7CoDJHkwpbTUGiyJGgs,2037
|
12
|
-
fotolab/subcommands/resize.py,sha256=2bH1Kgoe_DqU8ozJ1E_oA6a9JPtuwIlo5a4sq_4Yles,5018
|
13
|
-
fotolab/subcommands/rotate.py,sha256=27Xrc8iV9n8WI6tOE-vBBMUeSYu2CtZAh-PGcF7JL-k,2144
|
14
|
-
fotolab/subcommands/sharpen.py,sha256=wUPtJdtB6mCRmcHrA0CoEVO0O0ROBJWhejTvUeL67QU,2655
|
15
|
-
fotolab/subcommands/watermark.py,sha256=5vsMDeJZhLT5qmftJQXY4jK2gtPQsbTYKXA6Ye2MqmA,8900
|
16
|
-
fotolab-0.24.0.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
|
17
|
-
fotolab-0.24.0.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
18
|
-
fotolab-0.24.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
19
|
-
fotolab-0.24.0.dist-info/METADATA,sha256=VH-jJMrow1yoLw1XXO4eVgl1putj9tJuLFd93Tg9MSE,10975
|
20
|
-
fotolab-0.24.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|