fotolab 0.24.0__tar.gz → 0.25.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 (42) hide show
  1. {fotolab-0.24.0 → fotolab-0.25.0}/.pre-commit-config.yaml +1 -1
  2. {fotolab-0.24.0 → fotolab-0.25.0}/CHANGELOG.md +6 -0
  3. {fotolab-0.24.0 → fotolab-0.25.0}/PKG-INFO +2 -2
  4. {fotolab-0.24.0 → fotolab-0.25.0}/README.md +1 -1
  5. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/__init__.py +2 -2
  6. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/cli.py +1 -1
  7. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/subcommands/__init__.py +1 -1
  8. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/subcommands/animate.py +1 -1
  9. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/subcommands/auto.py +2 -1
  10. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/subcommands/border.py +1 -1
  11. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/subcommands/contrast.py +1 -1
  12. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/subcommands/env.py +1 -1
  13. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/subcommands/info.py +1 -2
  14. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/subcommands/montage.py +1 -1
  15. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/subcommands/resize.py +1 -1
  16. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/subcommands/rotate.py +1 -1
  17. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/subcommands/sharpen.py +40 -3
  18. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/subcommands/watermark.py +1 -1
  19. {fotolab-0.24.0 → fotolab-0.25.0}/.coveragerc +0 -0
  20. {fotolab-0.24.0 → fotolab-0.25.0}/.gitignore +0 -0
  21. {fotolab-0.24.0 → fotolab-0.25.0}/.python-version +0 -0
  22. {fotolab-0.24.0 → fotolab-0.25.0}/CONTRIBUTING.md +0 -0
  23. {fotolab-0.24.0 → fotolab-0.25.0}/LICENSE.md +0 -0
  24. {fotolab-0.24.0 → fotolab-0.25.0}/Pipfile +0 -0
  25. {fotolab-0.24.0 → fotolab-0.25.0}/Pipfile.lock +0 -0
  26. {fotolab-0.24.0 → fotolab-0.25.0}/docs/Makefile +0 -0
  27. {fotolab-0.24.0 → fotolab-0.25.0}/docs/make.bat +0 -0
  28. {fotolab-0.24.0 → fotolab-0.25.0}/docs/source/CHANGELOG.md +0 -0
  29. {fotolab-0.24.0 → fotolab-0.25.0}/docs/source/CONTRIBUTING.md +0 -0
  30. {fotolab-0.24.0 → fotolab-0.25.0}/docs/source/LICENSE.md +0 -0
  31. {fotolab-0.24.0 → fotolab-0.25.0}/docs/source/README.md +0 -0
  32. {fotolab-0.24.0 → fotolab-0.25.0}/docs/source/_static/logo.jpg +0 -0
  33. {fotolab-0.24.0 → fotolab-0.25.0}/docs/source/conf.py +0 -0
  34. {fotolab-0.24.0 → fotolab-0.25.0}/docs/source/index.rst +0 -0
  35. {fotolab-0.24.0 → fotolab-0.25.0}/fotolab/__main__.py +0 -0
  36. {fotolab-0.24.0 → fotolab-0.25.0}/noxfile.py +0 -0
  37. {fotolab-0.24.0 → fotolab-0.25.0}/pyproject.toml +0 -0
  38. {fotolab-0.24.0 → fotolab-0.25.0}/tests/__init__.py +0 -0
  39. {fotolab-0.24.0 → fotolab-0.25.0}/tests/conftest.py +0 -0
  40. {fotolab-0.24.0 → fotolab-0.25.0}/tests/test_env.py +0 -0
  41. {fotolab-0.24.0 → fotolab-0.25.0}/tests/test_help_flag.py +0 -0
  42. {fotolab-0.24.0 → fotolab-0.25.0}/tests/test_quiet_flag.py +0 -0
@@ -107,7 +107,7 @@ repos:
107
107
  - --disable=R0801,W0212
108
108
 
109
109
  - repo: https://github.com/pre-commit/mirrors-mypy
110
- rev: v1.14.0
110
+ rev: v1.14.1
111
111
  hooks:
112
112
  - id: mypy
113
113
  exclude: docs/
@@ -7,6 +7,12 @@ and this project adheres to [0-based versioning](https://0ver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## v0.25.0 (2025-01-05)
11
+
12
+ - Add `--before-after` or `-ba` flag to `sharpen` command
13
+ - Bump `pre-commit` hook and deps
14
+ - Bump copyright years
15
+
10
16
  ## v0.24.0 (2024-12-29)
11
17
 
12
18
  - Bump `pre-commit` hook
@@ -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
@@ -362,7 +362,7 @@ options:
362
362
 
363
363
  ## Copyright and License
364
364
 
365
- Copyright (C) 2024 Kian-Meng Ang
365
+ Copyright (C) 2024,2025 Kian-Meng Ang
366
366
 
367
367
  This program is free software: you can redistribute it and/or modify it under
368
368
  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
@@ -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
 
@@ -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
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