fotolab 0.24.0__py3-none-any.whl → 0.25.0__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 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.0"
24
+ __version__ = "0.25.0"
25
25
 
26
26
  log = logging.getLogger(__name__)
27
27
 
fotolab/cli.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
4
4
  # it under the terms of the GNU General Public License as published by
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
 
@@ -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
@@ -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
@@ -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
@@ -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
- save_image(args, sharpen_image, image_filename, "sharpen")
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)
@@ -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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fotolab
3
- Version: 0.24.0
3
+ Version: 0.25.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>
@@ -385,7 +385,7 @@ options:
385
385
 
386
386
  ## Copyright and License
387
387
 
388
- Copyright (C) 2024 Kian-Meng Ang
388
+ Copyright (C) 2024,2025 Kian-Meng Ang
389
389
 
390
390
  This program is free software: you can redistribute it and/or modify it under
391
391
  the terms of the GNU Affero General Public License as published by the Free
@@ -0,0 +1,20 @@
1
+ fotolab/__init__.py,sha256=Q-uGtGYhMgsiocBd99EGzDzXlP7ak1kfVRvKyNAsh-o,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=_W4K_D0eOiE30iIhlfyXCoeqF47q7adh82TeWMywR5I,3596
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=MwZ0z7oWFAElIE3Kh7VQxQRtvcb0n97Q65PGK9ab0SY,2042
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.0.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
17
+ fotolab-0.25.0.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
18
+ fotolab-0.25.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
19
+ fotolab-0.25.0.dist-info/METADATA,sha256=jmNKiKHpBzNMQf6LDqKs2qElLlXLtDRad1PoRcdpSrw,10980
20
+ fotolab-0.25.0.dist-info/RECORD,,
@@ -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,,