fotolab 0.27.0__py3-none-any.whl → 0.27.2__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 -1
- fotolab/cli.py +10 -9
- fotolab/subcommands/animate.py +1 -1
- fotolab/subcommands/auto.py +1 -1
- fotolab/subcommands/border.py +1 -1
- fotolab/subcommands/contrast.py +1 -1
- fotolab/subcommands/env.py +1 -1
- fotolab/subcommands/halftone.py +1 -1
- fotolab/subcommands/info.py +1 -1
- fotolab/subcommands/montage.py +1 -1
- fotolab/subcommands/rotate.py +1 -1
- fotolab/subcommands/sharpen.py +7 -2
- fotolab/subcommands/watermark.py +40 -8
- {fotolab-0.27.0.dist-info → fotolab-0.27.2.dist-info}/METADATA +1 -1
- fotolab-0.27.2.dist-info/RECORD +21 -0
- fotolab-0.27.0.dist-info/RECORD +0 -21
- {fotolab-0.27.0.dist-info → fotolab-0.27.2.dist-info}/LICENSE.md +0 -0
- {fotolab-0.27.0.dist-info → fotolab-0.27.2.dist-info}/WHEEL +0 -0
- {fotolab-0.27.0.dist-info → fotolab-0.27.2.dist-info}/entry_points.txt +0 -0
fotolab/__init__.py
CHANGED
@@ -20,7 +20,7 @@ import subprocess
|
|
20
20
|
import sys
|
21
21
|
from pathlib import Path
|
22
22
|
|
23
|
-
__version__ = "0.27.
|
23
|
+
__version__ = "0.27.2"
|
24
24
|
|
25
25
|
log = logging.getLogger(__name__)
|
26
26
|
|
@@ -31,6 +31,7 @@ def save_image(args, new_image, output_filename, subcommand):
|
|
31
31
|
Args:
|
32
32
|
args (argparse.Namespace): Config from command line arguments
|
33
33
|
new_image(PIL.Image.Image): Modified image
|
34
|
+
output_filename(str): Save filename image
|
34
35
|
subcommand(str): Subcommand used to call this function
|
35
36
|
|
36
37
|
Returns:
|
fotolab/cli.py
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
# This program is distributed in the hope that it will be useful,
|
9
9
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
10
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU
|
11
|
+
# GNU General Public License for more details.
|
12
12
|
|
13
13
|
# You should have received a copy of the GNU General Public License
|
14
14
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
@@ -147,15 +147,16 @@ def main(args: Optional[Sequence[str]] = None) -> None:
|
|
147
147
|
parser = build_parser()
|
148
148
|
if len(args) == 0:
|
149
149
|
parser.print_help(sys.stderr)
|
150
|
+
return
|
151
|
+
|
152
|
+
parsed_args = parser.parse_args(args)
|
153
|
+
setup_logging(parsed_args)
|
154
|
+
|
155
|
+
if hasattr(parsed_args, "func"):
|
156
|
+
log.debug(parsed_args)
|
157
|
+
parsed_args.func(parsed_args)
|
150
158
|
else:
|
151
|
-
|
152
|
-
setup_logging(parsed_args)
|
153
|
-
|
154
|
-
if hasattr(parsed_args, "func"):
|
155
|
-
log.debug(parsed_args)
|
156
|
-
parsed_args.func(parsed_args)
|
157
|
-
else:
|
158
|
-
parser.print_help(sys.stderr)
|
159
|
+
parser.print_help(sys.stderr)
|
159
160
|
|
160
161
|
except Exception as error:
|
161
162
|
log.error(
|
fotolab/subcommands/animate.py
CHANGED
fotolab/subcommands/auto.py
CHANGED
fotolab/subcommands/border.py
CHANGED
fotolab/subcommands/contrast.py
CHANGED
fotolab/subcommands/env.py
CHANGED
fotolab/subcommands/halftone.py
CHANGED
fotolab/subcommands/info.py
CHANGED
fotolab/subcommands/montage.py
CHANGED
fotolab/subcommands/rotate.py
CHANGED
fotolab/subcommands/sharpen.py
CHANGED
@@ -91,7 +91,7 @@ def run(args: argparse.Namespace) -> None:
|
|
91
91
|
"""Run sharpen subcommand.
|
92
92
|
|
93
93
|
Args:
|
94
|
-
|
94
|
+
args (argparse.Namespace): Config from command line arguments
|
95
95
|
|
96
96
|
Returns:
|
97
97
|
None
|
@@ -111,7 +111,12 @@ def run(args: argparse.Namespace) -> None:
|
|
111
111
|
save_image(args, sharpen_image, image_filename, "sharpen")
|
112
112
|
|
113
113
|
|
114
|
-
def save_gif_image(
|
114
|
+
def save_gif_image(
|
115
|
+
args: argparse.Namespace,
|
116
|
+
image_filename: str,
|
117
|
+
original_image: Image.Image,
|
118
|
+
sharpen_image: Image.Image,
|
119
|
+
) -> None:
|
115
120
|
"""Save the original and sharpen image."""
|
116
121
|
image_file = Path(image_filename)
|
117
122
|
new_filename = Path(
|
fotolab/subcommands/watermark.py
CHANGED
@@ -18,6 +18,7 @@
|
|
18
18
|
import argparse
|
19
19
|
import logging
|
20
20
|
import math
|
21
|
+
from pathlib import Path
|
21
22
|
|
22
23
|
from PIL import Image, ImageColor, ImageDraw, ImageFont, ImageSequence
|
23
24
|
|
@@ -159,24 +160,47 @@ def run(args: argparse.Namespace) -> None:
|
|
159
160
|
for image_filename in args.image_filenames:
|
160
161
|
image = Image.open(image_filename)
|
161
162
|
if image.format == "GIF":
|
162
|
-
watermark_gif_image(image, args)
|
163
|
+
watermark_gif_image(image, image_filename, args)
|
163
164
|
else:
|
164
165
|
watermarked_image = watermark_non_gif_image(image, args)
|
165
166
|
save_image(args, watermarked_image, image_filename, "watermark")
|
166
167
|
|
167
168
|
|
168
|
-
def watermark_gif_image(
|
169
|
-
|
169
|
+
def watermark_gif_image(
|
170
|
+
original_image: Image.Image, output_filename: str, args: argparse.Namespace
|
171
|
+
) -> None:
|
172
|
+
"""Watermark a GIF image.
|
173
|
+
|
174
|
+
Args:
|
175
|
+
original_image (Image.Image): The original GIF image
|
176
|
+
output_filename (str): Path to save the watermarked GIF
|
177
|
+
args (argparse.Namespace): Command line arguments
|
178
|
+
|
179
|
+
Returns:
|
180
|
+
None
|
181
|
+
"""
|
170
182
|
frames = []
|
171
183
|
for frame in ImageSequence.Iterator(original_image):
|
172
184
|
watermarked_frame = watermark_image(args, frame.convert("RGBA"))
|
173
185
|
frames.append(watermarked_frame)
|
174
186
|
|
187
|
+
image_file = Path(output_filename)
|
188
|
+
|
189
|
+
if args.overwrite:
|
190
|
+
new_filename = original_image.with_name(image_file.name)
|
191
|
+
else:
|
192
|
+
new_filename = Path(
|
193
|
+
args.output_dir,
|
194
|
+
image_file.with_name(f"watermark_{image_file.name}"),
|
195
|
+
)
|
196
|
+
new_filename.parent.mkdir(parents=True, exist_ok=True)
|
197
|
+
|
198
|
+
log.info("%s image: %s", "watermark", new_filename.resolve())
|
199
|
+
|
175
200
|
frames[0].save(
|
176
|
-
|
177
|
-
format="GIF",
|
178
|
-
append_images=frames[1:],
|
201
|
+
new_filename,
|
179
202
|
save_all=True,
|
203
|
+
append_images=frames[1:],
|
180
204
|
duration=original_image.info.get("duration", 100),
|
181
205
|
loop=original_image.info.get("loop", 0),
|
182
206
|
disposal=original_image.info.get("disposal", 2),
|
@@ -185,8 +209,16 @@ def watermark_gif_image(original_image: Image.Image, args: argparse.Namespace):
|
|
185
209
|
|
186
210
|
def watermark_non_gif_image(
|
187
211
|
original_image: Image.Image, args: argparse.Namespace
|
188
|
-
):
|
189
|
-
"""Watermark
|
212
|
+
) -> Image.Image:
|
213
|
+
"""Watermark a non-GIF image.
|
214
|
+
|
215
|
+
Args:
|
216
|
+
original_image (Image.Image): The original image
|
217
|
+
args (argparse.Namespace): Command line arguments
|
218
|
+
|
219
|
+
Returns:
|
220
|
+
Image.Image: The watermarked image
|
221
|
+
"""
|
190
222
|
return watermark_image(args, original_image)
|
191
223
|
|
192
224
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
fotolab/__init__.py,sha256=Kr5BlzHH7WlWdyJr8dGmgyL7QSgpCWNRqjhn6jEspCk,2222
|
2
|
+
fotolab/__main__.py,sha256=aboOURPs_snOXTEWYR0q8oq1UTY9e-NxCd1j33V0wHI,833
|
3
|
+
fotolab/cli.py,sha256=a72F2y8OJo1pscwn-bSqiWVt4e6nhvvDWu9xdCO5p8A,4342
|
4
|
+
fotolab/subcommands/__init__.py,sha256=l3DlIaJ3u3jGjnC1H1yV8LZ_nPqOLJ6gikD4BCaMAQ0,1129
|
5
|
+
fotolab/subcommands/animate.py,sha256=MJQ-QXy35bXWpYmX3NcLN83n1NEDyAUOXcsyhLc2YjU,2970
|
6
|
+
fotolab/subcommands/auto.py,sha256=ia-xegV1Z4HvYsbKgmTzf1NfNFdTDPWfZe7vQ1_90Ik,2425
|
7
|
+
fotolab/subcommands/border.py,sha256=CPE1nZyBwgBRihvzccqktFHlRtLt2Tt2bxaStQj2M-0,3939
|
8
|
+
fotolab/subcommands/contrast.py,sha256=jgauUBlvCdGa0t_TujBe5FYTmo8It0ped94T1xxB67w,2098
|
9
|
+
fotolab/subcommands/env.py,sha256=QoxRvzZKgmoHTUxDV4QYhdChCpMWs5TbXFY_qIpIQpE,1469
|
10
|
+
fotolab/subcommands/halftone.py,sha256=5Nx_deJUc4LhK9omqGZUQzFTDcDd9RkqjmCMnXRm1WA,4320
|
11
|
+
fotolab/subcommands/info.py,sha256=V15NU2Edk4RwFbtmxJQmVFhF9QOn1PUTV8o3PxS8y8c,3310
|
12
|
+
fotolab/subcommands/montage.py,sha256=LVJ8sqkPv46PlHv4pKDEHVIYfV67vDe7BvF7SVrM5-M,2143
|
13
|
+
fotolab/subcommands/resize.py,sha256=d2Nlslzlvri9L2rqmE-HbmnLozylSk3U1Hi3DF1q3Mc,5023
|
14
|
+
fotolab/subcommands/rotate.py,sha256=jk7W6HwCtZPQHekPpgUyYDrpZr_HkojEgaOAWwQF0kE,2154
|
15
|
+
fotolab/subcommands/sharpen.py,sha256=DhnhH0GGfzk4GdhoI-ucsp6MEICdmeskLQo2H5D9hFs,3776
|
16
|
+
fotolab/subcommands/watermark.py,sha256=jqkdi1dLZ8K6PWxqhFUhTogsNl0fBez7yGEs-N1gFm0,9022
|
17
|
+
fotolab-0.27.2.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
|
18
|
+
fotolab-0.27.2.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
19
|
+
fotolab-0.27.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
20
|
+
fotolab-0.27.2.dist-info/METADATA,sha256=6AFvwNEaWV-4TMqloJ8F-d75chxlH7U2QT49oZCqCyY,11114
|
21
|
+
fotolab-0.27.2.dist-info/RECORD,,
|
fotolab-0.27.0.dist-info/RECORD
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
fotolab/__init__.py,sha256=JLPVtm3Ac88Il9-YmaGXkWsbUdbl71qnktYpM3BKhvo,2172
|
2
|
-
fotolab/__main__.py,sha256=aboOURPs_snOXTEWYR0q8oq1UTY9e-NxCd1j33V0wHI,833
|
3
|
-
fotolab/cli.py,sha256=fwSpCFW64ACEhH9JZER9OqxULbBzm5eVtkch3E6wwv4,4365
|
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=SwxGWzKxQACZH0u2z2jIvuqdx_OvXKDaCVptP5K7D7c,3941
|
8
|
-
fotolab/subcommands/contrast.py,sha256=8uPCd5xI-aUsL7rjdEPmfSskdzMwM-1tv0eRRONkW2M,2100
|
9
|
-
fotolab/subcommands/env.py,sha256=JamU3a2xWPbwlAj5iThHs58KYkLmjpUphZfTQODBp_4,1471
|
10
|
-
fotolab/subcommands/halftone.py,sha256=Xlbj3nVzqBXLzfemhF66nWV9U-PJHcG1Q2m2HiDhjI0,4322
|
11
|
-
fotolab/subcommands/info.py,sha256=DANbfBNy2SzFfeE4KqOViAZkaME6xujfZvJTHIaZyCY,3312
|
12
|
-
fotolab/subcommands/montage.py,sha256=TrMcYIeuzNHev-QGbBCA3htBfDjxPomtMXNtlKGBRmw,2145
|
13
|
-
fotolab/subcommands/resize.py,sha256=d2Nlslzlvri9L2rqmE-HbmnLozylSk3U1Hi3DF1q3Mc,5023
|
14
|
-
fotolab/subcommands/rotate.py,sha256=wRWRG4PMLmw5kOi6NsLsNkh0Aw2WaBAdScWfBwGjDeM,2156
|
15
|
-
fotolab/subcommands/sharpen.py,sha256=xz8RW8cRPM4eUvJTO1Stsur3G67DBftVGza8kF5j2Pc,3700
|
16
|
-
fotolab/subcommands/watermark.py,sha256=a4GEVZG64B1giUigweXvDGS-Y7PeBXFyyrsHuko6ClQ,8124
|
17
|
-
fotolab-0.27.0.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
|
18
|
-
fotolab-0.27.0.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
19
|
-
fotolab-0.27.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
20
|
-
fotolab-0.27.0.dist-info/METADATA,sha256=MmQBQofr3eMnOji4Vx9jGooDml3k_5GCqS3ak3I0wto,11114
|
21
|
-
fotolab-0.27.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|