fotolab 0.26.0__tar.gz → 0.26.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.26.0 → fotolab-0.26.1}/.pre-commit-config.yaml +1 -1
  2. {fotolab-0.26.0 → fotolab-0.26.1}/CHANGELOG.md +6 -0
  3. {fotolab-0.26.0 → fotolab-0.26.1}/PKG-INFO +1 -1
  4. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/__init__.py +2 -2
  5. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/subcommands/halftone.py +41 -2
  6. {fotolab-0.26.0 → fotolab-0.26.1}/.coveragerc +0 -0
  7. {fotolab-0.26.0 → fotolab-0.26.1}/.gitignore +0 -0
  8. {fotolab-0.26.0 → fotolab-0.26.1}/.python-version +0 -0
  9. {fotolab-0.26.0 → fotolab-0.26.1}/CONTRIBUTING.md +0 -0
  10. {fotolab-0.26.0 → fotolab-0.26.1}/LICENSE.md +0 -0
  11. {fotolab-0.26.0 → fotolab-0.26.1}/Pipfile +0 -0
  12. {fotolab-0.26.0 → fotolab-0.26.1}/Pipfile.lock +0 -0
  13. {fotolab-0.26.0 → fotolab-0.26.1}/README.md +0 -0
  14. {fotolab-0.26.0 → fotolab-0.26.1}/docs/Makefile +0 -0
  15. {fotolab-0.26.0 → fotolab-0.26.1}/docs/make.bat +0 -0
  16. {fotolab-0.26.0 → fotolab-0.26.1}/docs/source/CHANGELOG.md +0 -0
  17. {fotolab-0.26.0 → fotolab-0.26.1}/docs/source/CONTRIBUTING.md +0 -0
  18. {fotolab-0.26.0 → fotolab-0.26.1}/docs/source/LICENSE.md +0 -0
  19. {fotolab-0.26.0 → fotolab-0.26.1}/docs/source/README.md +0 -0
  20. {fotolab-0.26.0 → fotolab-0.26.1}/docs/source/_static/logo.jpg +0 -0
  21. {fotolab-0.26.0 → fotolab-0.26.1}/docs/source/conf.py +0 -0
  22. {fotolab-0.26.0 → fotolab-0.26.1}/docs/source/index.rst +0 -0
  23. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/__main__.py +0 -0
  24. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/cli.py +0 -0
  25. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/subcommands/__init__.py +0 -0
  26. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/subcommands/animate.py +0 -0
  27. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/subcommands/auto.py +0 -0
  28. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/subcommands/border.py +0 -0
  29. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/subcommands/contrast.py +0 -0
  30. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/subcommands/env.py +0 -0
  31. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/subcommands/info.py +0 -0
  32. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/subcommands/montage.py +0 -0
  33. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/subcommands/resize.py +0 -0
  34. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/subcommands/rotate.py +0 -0
  35. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/subcommands/sharpen.py +0 -0
  36. {fotolab-0.26.0 → fotolab-0.26.1}/fotolab/subcommands/watermark.py +0 -0
  37. {fotolab-0.26.0 → fotolab-0.26.1}/noxfile.py +0 -0
  38. {fotolab-0.26.0 → fotolab-0.26.1}/pyproject.toml +0 -0
  39. {fotolab-0.26.0 → fotolab-0.26.1}/tests/__init__.py +0 -0
  40. {fotolab-0.26.0 → fotolab-0.26.1}/tests/conftest.py +0 -0
  41. {fotolab-0.26.0 → fotolab-0.26.1}/tests/test_env.py +0 -0
  42. {fotolab-0.26.0 → fotolab-0.26.1}/tests/test_help_flag.py +0 -0
  43. {fotolab-0.26.0 → fotolab-0.26.1}/tests/test_quiet_flag.py +0 -0
@@ -21,7 +21,7 @@ repos:
21
21
  name: validate-pyproject
22
22
 
23
23
  - repo: https://github.com/codespell-project/codespell
24
- rev: v2.3.0
24
+ rev: v2.4.0
25
25
  hooks:
26
26
  - id: codespell
27
27
  args:
@@ -7,6 +7,12 @@ and this project adheres to [0-based versioning](https://0ver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## v0.26.1 (2025-01-26)
11
+
12
+ - Add `--before-and-after` flag to `halftone` subcommand
13
+ - Remove unused imports
14
+ - Resolve `pylint` issues
15
+
10
16
  ## v0.26.0 (2025-01-19)
11
17
 
12
18
  - Add `halftone` subcommand
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fotolab
3
- Version: 0.26.0
3
+ Version: 0.26.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>
@@ -20,7 +20,7 @@ import subprocess
20
20
  import sys
21
21
  from pathlib import Path
22
22
 
23
- __version__ = "0.26.0"
23
+ __version__ = "0.26.1"
24
24
 
25
25
  log = logging.getLogger(__name__)
26
26
 
@@ -59,7 +59,7 @@ def _open_image(filename):
59
59
  platform_open_func = {
60
60
  "linux": subprocess.call(["xdg-open", filename]),
61
61
  "darwin": subprocess.call(["open", filename]),
62
- "windows": subprocess.Popen(["start", filename]),
62
+ "windows": subprocess.call(["start", filename]),
63
63
  }
64
64
  try:
65
65
  platform_open_func[sys.platform]
@@ -18,10 +18,11 @@
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, ImageDraw
23
24
 
24
- from fotolab import save_image
25
+ from fotolab import _open_image, save_image
25
26
 
26
27
  log = logging.getLogger(__name__)
27
28
 
@@ -43,6 +44,15 @@ def build_subparser(subparsers) -> None:
43
44
  metavar="IMAGE_FILENAMES",
44
45
  )
45
46
 
47
+ halftone_parser.add_argument(
48
+ "-ba",
49
+ "--before-after",
50
+ default=False,
51
+ action="store_true",
52
+ dest="before_after",
53
+ help="generate a GIF showing before and after changes",
54
+ )
55
+
46
56
 
47
57
  def run(args: argparse.Namespace) -> None:
48
58
  """Run halftone subcommand.
@@ -90,4 +100,33 @@ def run(args: argparse.Namespace) -> None:
90
100
  [x - amp / 2, y - amp / 2, x + amp / 2, y + amp / 2], fill=255
91
101
  )
92
102
 
93
- save_image(args, halftone_image, image_filename, "halftone")
103
+ if args.before_after:
104
+ save_gif_image(
105
+ args, image_filename, original_image, halftone_image
106
+ )
107
+ else:
108
+ save_image(args, halftone_image, image_filename, "halftone")
109
+
110
+
111
+ def save_gif_image(args, image_filename, original_image, sharpen_image):
112
+ """Save the original and sharpen image."""
113
+ image_file = Path(image_filename)
114
+ new_filename = Path(
115
+ args.output_dir,
116
+ image_file.with_name(f"sharpen_gif_{image_file.stem}.gif"),
117
+ )
118
+ new_filename.parent.mkdir(parents=True, exist_ok=True)
119
+
120
+ log.info("sharpen gif image: %s", new_filename)
121
+ original_image.save(
122
+ new_filename,
123
+ format="gif",
124
+ append_images=[sharpen_image],
125
+ save_all=True,
126
+ duration=2500,
127
+ loop=0,
128
+ optimize=True,
129
+ )
130
+
131
+ if args.open:
132
+ _open_image(new_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
File without changes
File without changes