fotolab 0.33.2__tar.gz → 0.34.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.
Files changed (41) hide show
  1. {fotolab-0.33.2/src/fotolab.egg-info → fotolab-0.34.0}/PKG-INFO +3 -3
  2. {fotolab-0.33.2 → fotolab-0.34.0}/pyproject.toml +3 -3
  3. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/__init__.py +5 -4
  4. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/cli.py +9 -3
  5. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/subcommands/animate.py +2 -2
  6. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/subcommands/contrast.py +19 -3
  7. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/subcommands/halftone.py +2 -2
  8. {fotolab-0.33.2 → fotolab-0.34.0/src/fotolab.egg-info}/PKG-INFO +3 -3
  9. {fotolab-0.33.2 → fotolab-0.34.0}/LICENSE.md +0 -0
  10. {fotolab-0.33.2 → fotolab-0.34.0}/README.md +0 -0
  11. {fotolab-0.33.2 → fotolab-0.34.0}/setup.cfg +0 -0
  12. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/__main__.py +0 -0
  13. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/subcommands/__init__.py +0 -0
  14. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/subcommands/auto.py +0 -0
  15. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/subcommands/border.py +0 -0
  16. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/subcommands/env.py +0 -0
  17. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/subcommands/info.py +0 -0
  18. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/subcommands/montage.py +0 -0
  19. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/subcommands/resize.py +0 -0
  20. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/subcommands/rotate.py +0 -0
  21. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/subcommands/sharpen.py +0 -0
  22. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab/subcommands/watermark.py +0 -0
  23. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab.egg-info/SOURCES.txt +0 -0
  24. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab.egg-info/dependency_links.txt +0 -0
  25. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab.egg-info/entry_points.txt +0 -0
  26. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab.egg-info/requires.txt +0 -0
  27. {fotolab-0.33.2 → fotolab-0.34.0}/src/fotolab.egg-info/top_level.txt +0 -0
  28. {fotolab-0.33.2 → fotolab-0.34.0}/tests/test_animate_subcommand.py +0 -0
  29. {fotolab-0.33.2 → fotolab-0.34.0}/tests/test_auto_subcommand.py +0 -0
  30. {fotolab-0.33.2 → fotolab-0.34.0}/tests/test_border_subcommand.py +0 -0
  31. {fotolab-0.33.2 → fotolab-0.34.0}/tests/test_contrast_subcommand.py +0 -0
  32. {fotolab-0.33.2 → fotolab-0.34.0}/tests/test_env_subcommand.py +0 -0
  33. {fotolab-0.33.2 → fotolab-0.34.0}/tests/test_halftone_subcommand.py +0 -0
  34. {fotolab-0.33.2 → fotolab-0.34.0}/tests/test_help_flag.py +0 -0
  35. {fotolab-0.33.2 → fotolab-0.34.0}/tests/test_info_subcommand.py +0 -0
  36. {fotolab-0.33.2 → fotolab-0.34.0}/tests/test_montage_subcommand.py +0 -0
  37. {fotolab-0.33.2 → fotolab-0.34.0}/tests/test_quiet_flag.py +0 -0
  38. {fotolab-0.33.2 → fotolab-0.34.0}/tests/test_resize_subcommand.py +0 -0
  39. {fotolab-0.33.2 → fotolab-0.34.0}/tests/test_rotate_subcommand.py +0 -0
  40. {fotolab-0.33.2 → fotolab-0.34.0}/tests/test_sharpen_subcommand.py +0 -0
  41. {fotolab-0.33.2 → fotolab-0.34.0}/tests/test_watermark_subcommand.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fotolab
3
- Version: 0.33.2
3
+ Version: 0.34.0
4
4
  Summary: A console program to manipulate photos.
5
5
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -11,13 +11,13 @@ Keywords: photography,photo
11
11
  Classifier: Development Status :: 3 - Alpha
12
12
  Classifier: Environment :: Console
13
13
  Classifier: Programming Language :: Python :: 3 :: Only
14
- Classifier: Programming Language :: Python :: 3.9
15
14
  Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
18
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
19
  Classifier: Programming Language :: Python
20
- Requires-Python: >=3.9
20
+ Requires-Python: >=3.10
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE.md
23
23
  Requires-Dist: pillow
@@ -7,10 +7,10 @@ where = ["src"]
7
7
 
8
8
  [project]
9
9
  name = "fotolab"
10
- version = "0.33.2"
10
+ version = "0.34.0"
11
11
  description = "A console program to manipulate photos."
12
12
  authors = [{name = "Kian-Meng Ang", email = "kianmeng@cpan.org"}]
13
- requires-python = ">=3.9"
13
+ requires-python = ">=3.10"
14
14
  readme = "README.md"
15
15
  license = "AGPL-3.0-or-later"
16
16
  license-files = ["LICENSE.md"]
@@ -18,11 +18,11 @@ classifiers = [
18
18
  "Development Status :: 3 - Alpha",
19
19
  "Environment :: Console",
20
20
  "Programming Language :: Python :: 3 :: Only",
21
- "Programming Language :: Python :: 3.9",
22
21
  "Programming Language :: Python :: 3.10",
23
22
  "Programming Language :: Python :: 3.11",
24
23
  "Programming Language :: Python :: 3.12",
25
24
  "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3.14",
26
26
  "Programming Language :: Python",
27
27
  ]
28
28
  keywords = ["photography", "photo"]
@@ -15,16 +15,17 @@
15
15
 
16
16
  """A console program that manipulate images."""
17
17
 
18
+ from importlib import metadata
19
+ from pathlib import Path
18
20
  import argparse
19
21
  import logging
20
22
  import os
21
23
  import subprocess
22
24
  import sys
23
- from pathlib import Path
24
25
 
25
26
  from PIL import Image
26
27
 
27
- __version__ = "0.31.15"
28
+ __version__ = metadata.version("fotolab")
28
29
 
29
30
  log = logging.getLogger(__name__)
30
31
 
@@ -69,7 +70,7 @@ def save_image(
69
70
  image.save(new_filename, **kwargs)
70
71
 
71
72
  if args.open:
72
- _open_image(new_filename)
73
+ open_image(new_filename)
73
74
 
74
75
 
75
76
  def _get_output_filename(
@@ -84,7 +85,7 @@ def _get_output_filename(
84
85
  return output_dir / image_file.with_name(f"{subcommand}_{image_file.name}")
85
86
 
86
87
 
87
- def _open_image(filename: Path):
88
+ def open_image(filename: Path):
88
89
  """Open generated image using default program."""
89
90
  try:
90
91
  if sys.platform == "linux":
@@ -23,7 +23,9 @@ issues: https://github.com/kianmeng/fotolab/issues
23
23
  import argparse
24
24
  import logging
25
25
  import sys
26
- from typing import Optional, Sequence
26
+ from typing import Sequence
27
+
28
+ from PIL import Image
27
29
 
28
30
  import fotolab.subcommands
29
31
  from fotolab import __version__
@@ -122,7 +124,7 @@ def build_parser() -> argparse.ArgumentParser:
122
124
  return parser
123
125
 
124
126
 
125
- def main(args: Optional[Sequence[str]] = None) -> None:
127
+ def main(args: Sequence[str] | None = None) -> None:
126
128
  """Run the main program flow."""
127
129
  args = args or sys.argv[1:]
128
130
  log.debug(args)
@@ -150,7 +152,11 @@ def main(args: Optional[Sequence[str]] = None) -> None:
150
152
  else:
151
153
  parser.print_help(sys.stderr)
152
154
 
153
- except Exception as error:
155
+ except (
156
+ FileNotFoundError,
157
+ ValueError,
158
+ Image.UnidentifiedImageError,
159
+ ) as error:
154
160
  log.error(
155
161
  "error: %s",
156
162
  getattr(error, "message", str(error)),
@@ -22,7 +22,7 @@ from contextlib import ExitStack
22
22
 
23
23
  from PIL import Image
24
24
 
25
- from fotolab import _open_image
25
+ from fotolab import open_image
26
26
 
27
27
  log = logging.getLogger(__name__)
28
28
 
@@ -205,4 +205,4 @@ def run(args: argparse.Namespace) -> None:
205
205
  main_frame.save(new_filename, **save_kwargs)
206
206
 
207
207
  if args.open:
208
- _open_image(new_filename)
208
+ open_image(new_filename)
@@ -104,8 +104,24 @@ def run(args: argparse.Namespace) -> None:
104
104
 
105
105
  for image_filename in args.image_filenames:
106
106
  original_image = Image.open(image_filename)
107
- contrast_image = ImageOps.autocontrast(
108
- original_image, cutoff=args.cutoff
109
- )
107
+
108
+ if original_image.mode == "RGBA":
109
+ # Split the image into RGB and Alpha channels
110
+ rgb_image = original_image.convert("RGB")
111
+ alpha_channel = original_image.getchannel("A")
112
+
113
+ # Apply autocontrast to the RGB part
114
+ contrasted_rgb = ImageOps.autocontrast(
115
+ rgb_image, cutoff=args.cutoff
116
+ )
117
+
118
+ # Merge the contrasted RGB part with the original Alpha channel
119
+ contrasted_rgb.putalpha(alpha_channel)
120
+ contrast_image = contrasted_rgb
121
+ else:
122
+ # For other modes (like RGB, L, etc.), apply autocontrast directly
123
+ contrast_image = ImageOps.autocontrast(
124
+ original_image, cutoff=args.cutoff
125
+ )
110
126
 
111
127
  save_image(args, contrast_image, Path(image_filename), "contrast")
@@ -19,7 +19,7 @@ import argparse
19
19
  import logging
20
20
  import math
21
21
  from pathlib import Path
22
- from typing import NamedTuple, Union
22
+ from typing import NamedTuple
23
23
 
24
24
  from PIL import Image, ImageDraw
25
25
 
@@ -200,7 +200,7 @@ def create_halftone_image(
200
200
  Image.Image: The halftone converted image
201
201
  """
202
202
  output_mode: str
203
- fill_color_black: Union[int, tuple[int, int, int]]
203
+ fill_color_black: int | tuple[int, int, int]
204
204
  fill_color_dot_for_grayscale: int
205
205
 
206
206
  if grayscale:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fotolab
3
- Version: 0.33.2
3
+ Version: 0.34.0
4
4
  Summary: A console program to manipulate photos.
5
5
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -11,13 +11,13 @@ Keywords: photography,photo
11
11
  Classifier: Development Status :: 3 - Alpha
12
12
  Classifier: Environment :: Console
13
13
  Classifier: Programming Language :: Python :: 3 :: Only
14
- Classifier: Programming Language :: Python :: 3.9
15
14
  Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
18
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
19
  Classifier: Programming Language :: Python
20
- Requires-Python: >=3.9
20
+ Requires-Python: >=3.10
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE.md
23
23
  Requires-Dist: pillow
File without changes
File without changes
File without changes