fotolab 0.28.0__tar.gz → 0.28.1__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 (43) hide show
  1. {fotolab-0.28.0 → fotolab-0.28.1}/.gitignore +2 -1
  2. {fotolab-0.28.0 → fotolab-0.28.1}/CHANGELOG.md +9 -0
  3. {fotolab-0.28.0 → fotolab-0.28.1}/PKG-INFO +1 -1
  4. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/__init__.py +14 -12
  5. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/subcommands/contrast.py +11 -6
  6. {fotolab-0.28.0 → fotolab-0.28.1}/.coveragerc +0 -0
  7. {fotolab-0.28.0 → fotolab-0.28.1}/.pre-commit-config.yaml +0 -0
  8. {fotolab-0.28.0 → fotolab-0.28.1}/.python-version +0 -0
  9. {fotolab-0.28.0 → fotolab-0.28.1}/CONTRIBUTING.md +0 -0
  10. {fotolab-0.28.0 → fotolab-0.28.1}/LICENSE.md +0 -0
  11. {fotolab-0.28.0 → fotolab-0.28.1}/Pipfile +0 -0
  12. {fotolab-0.28.0 → fotolab-0.28.1}/Pipfile.lock +0 -0
  13. {fotolab-0.28.0 → fotolab-0.28.1}/README.md +0 -0
  14. {fotolab-0.28.0 → fotolab-0.28.1}/docs/Makefile +0 -0
  15. {fotolab-0.28.0 → fotolab-0.28.1}/docs/make.bat +0 -0
  16. {fotolab-0.28.0 → fotolab-0.28.1}/docs/source/CHANGELOG.md +0 -0
  17. {fotolab-0.28.0 → fotolab-0.28.1}/docs/source/CONTRIBUTING.md +0 -0
  18. {fotolab-0.28.0 → fotolab-0.28.1}/docs/source/LICENSE.md +0 -0
  19. {fotolab-0.28.0 → fotolab-0.28.1}/docs/source/README.md +0 -0
  20. {fotolab-0.28.0 → fotolab-0.28.1}/docs/source/_static/logo.jpg +0 -0
  21. {fotolab-0.28.0 → fotolab-0.28.1}/docs/source/conf.py +0 -0
  22. {fotolab-0.28.0 → fotolab-0.28.1}/docs/source/index.rst +0 -0
  23. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/__main__.py +0 -0
  24. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/cli.py +0 -0
  25. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/subcommands/__init__.py +0 -0
  26. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/subcommands/animate.py +0 -0
  27. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/subcommands/auto.py +0 -0
  28. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/subcommands/border.py +0 -0
  29. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/subcommands/env.py +0 -0
  30. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/subcommands/halftone.py +0 -0
  31. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/subcommands/info.py +0 -0
  32. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/subcommands/montage.py +0 -0
  33. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/subcommands/resize.py +0 -0
  34. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/subcommands/rotate.py +0 -0
  35. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/subcommands/sharpen.py +0 -0
  36. {fotolab-0.28.0 → fotolab-0.28.1}/fotolab/subcommands/watermark.py +0 -0
  37. {fotolab-0.28.0 → fotolab-0.28.1}/noxfile.py +0 -0
  38. {fotolab-0.28.0 → fotolab-0.28.1}/pyproject.toml +0 -0
  39. {fotolab-0.28.0 → fotolab-0.28.1}/tests/__init__.py +0 -0
  40. {fotolab-0.28.0 → fotolab-0.28.1}/tests/conftest.py +0 -0
  41. {fotolab-0.28.0 → fotolab-0.28.1}/tests/test_env_subcommand.py +0 -0
  42. {fotolab-0.28.0 → fotolab-0.28.1}/tests/test_help_flag.py +0 -0
  43. {fotolab-0.28.0 → fotolab-0.28.1}/tests/test_quiet_flag.py +0 -0
@@ -160,6 +160,7 @@ cython_debug/
160
160
  #.idea/
161
161
 
162
162
  # heatmaps
163
- TODO
164
163
  *.png
164
+ .aider*
165
+ TODO
165
166
  output
@@ -7,6 +7,15 @@ and this project adheres to [0-based versioning](https://0ver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## v0.28.1 (2025-03-16)
11
+
12
+ - Add typehint to `_get_output_filename` function
13
+ - Fix incorrect log message formatting in save_gif_image function
14
+ - Handle `FileNotFoundError` and `IOError` exceptions when opening images
15
+ - Handle `OSError` when opening image files.
16
+ - Ignore aider files
17
+ - Revert refactoring on open image using default program
18
+
10
19
  ## v0.28.0 (2025-03-09)
11
20
 
12
21
  - Handle exception of private function with exif info
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fotolab
3
- Version: 0.28.0
3
+ Version: 0.28.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>
@@ -23,7 +23,7 @@ from pathlib import Path
23
23
 
24
24
  from PIL import Image
25
25
 
26
- __version__ = "0.28.0"
26
+ __version__ = "0.28.1"
27
27
 
28
28
  log = logging.getLogger(__name__)
29
29
 
@@ -43,7 +43,7 @@ def save_gif_image(
43
43
  )
44
44
  new_filename.parent.mkdir(parents=True, exist_ok=True)
45
45
 
46
- log.info("f{subcommand} gif image: %s", new_filename)
46
+ log.info("%s gif image: %s", subcommand, new_filename)
47
47
  original_image.save(
48
48
  new_filename,
49
49
  format="gif",
@@ -79,7 +79,9 @@ def save_image(args, new_image, output_filename, subcommand):
79
79
  _open_image(new_filename)
80
80
 
81
81
 
82
- def _get_output_filename(args, image_file, subcommand):
82
+ def _get_output_filename(
83
+ args: argparse.Namespace, image_file: Path, subcommand: str
84
+ ) -> Path:
83
85
  """Build and return output filename based on the command line options."""
84
86
  if args.overwrite:
85
87
  return image_file.with_name(image_file.name)
@@ -91,14 +93,14 @@ def _get_output_filename(args, image_file, subcommand):
91
93
 
92
94
  def _open_image(filename):
93
95
  """Open generated image using default program."""
94
- platform_open_func = {
95
- "linux": subprocess.call(["xdg-open", filename]),
96
- "darwin": subprocess.call(["open", filename]),
97
- "windows": subprocess.call(["start", filename]),
98
- }
99
96
  try:
100
- platform_open_func[sys.platform]
101
- except KeyError:
102
- print(f"Unsupported platform: {sys.platform}")
103
- else:
97
+ if sys.platform == "linux":
98
+ subprocess.call(["xdg-open", filename])
99
+ elif sys.platform == "darwin":
100
+ subprocess.call(["open", filename])
101
+ elif sys.platform == "windows":
102
+ subprocess.Popen(["open", filename])
104
103
  log.info("open image: %s", filename.resolve())
104
+
105
+ except OSError as e:
106
+ log.error("Error opening image: %s -> %s", filename, e)
@@ -86,9 +86,14 @@ def run(args: argparse.Namespace) -> None:
86
86
  log.debug(args)
87
87
 
88
88
  for image_filename in args.image_filenames:
89
- original_image = Image.open(image_filename)
90
- contrast_image = ImageOps.autocontrast(
91
- original_image, cutoff=args.cutoff
92
- )
93
-
94
- save_image(args, contrast_image, image_filename, "contrast")
89
+ try:
90
+ original_image = Image.open(image_filename)
91
+ contrast_image = ImageOps.autocontrast(
92
+ original_image, cutoff=args.cutoff
93
+ )
94
+
95
+ save_image(args, contrast_image, image_filename, "contrast")
96
+ except FileNotFoundError:
97
+ log.error(f"Image file not found: {image_filename}")
98
+ except IOError:
99
+ log.error(f"Cannot open or read image file: {image_filename}")
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