fotolab 0.26.0__tar.gz → 0.26.2__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.2}/.pre-commit-config.yaml +3 -3
  2. {fotolab-0.26.0 → fotolab-0.26.2}/CHANGELOG.md +15 -0
  3. {fotolab-0.26.0 → fotolab-0.26.2}/PKG-INFO +4 -3
  4. {fotolab-0.26.0 → fotolab-0.26.2}/README.md +3 -2
  5. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/__init__.py +2 -2
  6. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/subcommands/halftone.py +41 -2
  7. {fotolab-0.26.0 → fotolab-0.26.2}/.coveragerc +0 -0
  8. {fotolab-0.26.0 → fotolab-0.26.2}/.gitignore +0 -0
  9. {fotolab-0.26.0 → fotolab-0.26.2}/.python-version +0 -0
  10. {fotolab-0.26.0 → fotolab-0.26.2}/CONTRIBUTING.md +0 -0
  11. {fotolab-0.26.0 → fotolab-0.26.2}/LICENSE.md +0 -0
  12. {fotolab-0.26.0 → fotolab-0.26.2}/Pipfile +0 -0
  13. {fotolab-0.26.0 → fotolab-0.26.2}/Pipfile.lock +0 -0
  14. {fotolab-0.26.0 → fotolab-0.26.2}/docs/Makefile +0 -0
  15. {fotolab-0.26.0 → fotolab-0.26.2}/docs/make.bat +0 -0
  16. {fotolab-0.26.0 → fotolab-0.26.2}/docs/source/CHANGELOG.md +0 -0
  17. {fotolab-0.26.0 → fotolab-0.26.2}/docs/source/CONTRIBUTING.md +0 -0
  18. {fotolab-0.26.0 → fotolab-0.26.2}/docs/source/LICENSE.md +0 -0
  19. {fotolab-0.26.0 → fotolab-0.26.2}/docs/source/README.md +0 -0
  20. {fotolab-0.26.0 → fotolab-0.26.2}/docs/source/_static/logo.jpg +0 -0
  21. {fotolab-0.26.0 → fotolab-0.26.2}/docs/source/conf.py +0 -0
  22. {fotolab-0.26.0 → fotolab-0.26.2}/docs/source/index.rst +0 -0
  23. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/__main__.py +0 -0
  24. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/cli.py +0 -0
  25. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/subcommands/__init__.py +0 -0
  26. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/subcommands/animate.py +0 -0
  27. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/subcommands/auto.py +0 -0
  28. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/subcommands/border.py +0 -0
  29. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/subcommands/contrast.py +0 -0
  30. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/subcommands/env.py +0 -0
  31. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/subcommands/info.py +0 -0
  32. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/subcommands/montage.py +0 -0
  33. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/subcommands/resize.py +0 -0
  34. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/subcommands/rotate.py +0 -0
  35. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/subcommands/sharpen.py +0 -0
  36. {fotolab-0.26.0 → fotolab-0.26.2}/fotolab/subcommands/watermark.py +0 -0
  37. {fotolab-0.26.0 → fotolab-0.26.2}/noxfile.py +0 -0
  38. {fotolab-0.26.0 → fotolab-0.26.2}/pyproject.toml +0 -0
  39. {fotolab-0.26.0 → fotolab-0.26.2}/tests/__init__.py +0 -0
  40. {fotolab-0.26.0 → fotolab-0.26.2}/tests/conftest.py +0 -0
  41. /fotolab-0.26.0/tests/test_env.py → /fotolab-0.26.2/tests/test_env_subcommand.py +0 -0
  42. {fotolab-0.26.0 → fotolab-0.26.2}/tests/test_help_flag.py +0 -0
  43. {fotolab-0.26.0 → fotolab-0.26.2}/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.1
25
25
  hooks:
26
26
  - id: codespell
27
27
  args:
@@ -34,7 +34,7 @@ repos:
34
34
  exclude: (Pipfile.lock)
35
35
 
36
36
  - repo: https://github.com/pycqa/isort
37
- rev: 5.13.2
37
+ rev: 6.0.0
38
38
  hooks:
39
39
  - id: isort
40
40
  additional_dependencies:
@@ -45,7 +45,7 @@ repos:
45
45
  - --py=312
46
46
 
47
47
  - repo: https://github.com/psf/black
48
- rev: 24.10.0
48
+ rev: 25.1.0
49
49
  hooks:
50
50
  - id: black
51
51
  language_version: python3.12
@@ -7,6 +7,21 @@ and this project adheres to [0-based versioning](https://0ver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## v0.26.2 (2025-02-02)
11
+
12
+ - Add missing changelog item
13
+ - Bump `pre-commit` hooks
14
+ - Rename test by subcommand name
15
+ - Speed up the duration of `gif` image
16
+ - Update help message to readme
17
+
18
+ ## v0.26.1 (2025-01-26)
19
+
20
+ - Add `--before-and-after` flag to `halftone` subcommand
21
+ - Bump `pre-commit` hook
22
+ - Remove unused imports
23
+ - Resolve `pylint` issues
24
+
10
25
  ## v0.26.0 (2025-01-19)
11
26
 
12
27
  - 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.2
4
4
  Summary: A console program that manipulate images.
5
5
  Keywords: photography,photo
6
6
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
@@ -61,7 +61,7 @@ fotolab -h
61
61
 
62
62
  ```console
63
63
  usage: fotolab [-h] [-o] [-op] [-od OUTPUT_DIR] [-q] [-v] [-d] [-V]
64
- {animate,auto,border,contrast,env,info,montage,resize,rotate,sharpen,watermark} ...
64
+ {animate,auto,border,contrast,env,halftone,info,montage,resize,rotate,sharpen,watermark} ...
65
65
 
66
66
  A console program to manipulate photos.
67
67
 
@@ -70,13 +70,14 @@ changelog: https://github.com/kianmeng/fotolab/blob/master/CHANGELOG.md
70
70
  issues: https://github.com/kianmeng/fotolab/issues
71
71
 
72
72
  positional arguments:
73
- {animate,auto,border,contrast,env,info,montage,resize,rotate,sharpen,watermark}
73
+ {animate,auto,border,contrast,env,halftone,info,montage,resize,rotate,sharpen,watermark}
74
74
  sub-command help
75
75
  animate animate an image
76
76
  auto auto adjust (resize, contrast, and watermark) a photo
77
77
  border add border to image
78
78
  contrast contrast an image
79
79
  env print environment information for bug reporting
80
+ halftone halftone an image
80
81
  info info an image
81
82
  montage montage a list of image
82
83
  resize resize an image
@@ -38,7 +38,7 @@ fotolab -h
38
38
 
39
39
  ```console
40
40
  usage: fotolab [-h] [-o] [-op] [-od OUTPUT_DIR] [-q] [-v] [-d] [-V]
41
- {animate,auto,border,contrast,env,info,montage,resize,rotate,sharpen,watermark} ...
41
+ {animate,auto,border,contrast,env,halftone,info,montage,resize,rotate,sharpen,watermark} ...
42
42
 
43
43
  A console program to manipulate photos.
44
44
 
@@ -47,13 +47,14 @@ changelog: https://github.com/kianmeng/fotolab/blob/master/CHANGELOG.md
47
47
  issues: https://github.com/kianmeng/fotolab/issues
48
48
 
49
49
  positional arguments:
50
- {animate,auto,border,contrast,env,info,montage,resize,rotate,sharpen,watermark}
50
+ {animate,auto,border,contrast,env,halftone,info,montage,resize,rotate,sharpen,watermark}
51
51
  sub-command help
52
52
  animate animate an image
53
53
  auto auto adjust (resize, contrast, and watermark) a photo
54
54
  border add border to image
55
55
  contrast contrast an image
56
56
  env print environment information for bug reporting
57
+ halftone halftone an image
57
58
  info info an image
58
59
  montage montage a list of image
59
60
  resize resize an image
@@ -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.2"
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=1000,
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