fotolab 0.22.1__tar.gz → 0.23.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 (43) hide show
  1. fotolab-0.23.0/.python-version +5 -0
  2. {fotolab-0.22.1 → fotolab-0.23.0}/CHANGELOG.md +8 -0
  3. {fotolab-0.22.1 → fotolab-0.23.0}/PKG-INFO +14 -9
  4. {fotolab-0.22.1 → fotolab-0.23.0}/README.md +13 -8
  5. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/__init__.py +1 -1
  6. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/cli.py +21 -16
  7. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/subcommands/rotate.py +20 -1
  8. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/subcommands/watermark.py +11 -16
  9. fotolab-0.22.1/.python-version +0 -5
  10. {fotolab-0.22.1 → fotolab-0.23.0}/.coveragerc +0 -0
  11. {fotolab-0.22.1 → fotolab-0.23.0}/.gitignore +0 -0
  12. {fotolab-0.22.1 → fotolab-0.23.0}/.pre-commit-config.yaml +0 -0
  13. {fotolab-0.22.1 → fotolab-0.23.0}/CONTRIBUTING.md +0 -0
  14. {fotolab-0.22.1 → fotolab-0.23.0}/LICENSE.md +0 -0
  15. {fotolab-0.22.1 → fotolab-0.23.0}/Pipfile +0 -0
  16. {fotolab-0.22.1 → fotolab-0.23.0}/Pipfile.lock +0 -0
  17. {fotolab-0.22.1 → fotolab-0.23.0}/docs/Makefile +0 -0
  18. {fotolab-0.22.1 → fotolab-0.23.0}/docs/make.bat +0 -0
  19. {fotolab-0.22.1 → fotolab-0.23.0}/docs/source/CHANGELOG.md +0 -0
  20. {fotolab-0.22.1 → fotolab-0.23.0}/docs/source/CONTRIBUTING.md +0 -0
  21. {fotolab-0.22.1 → fotolab-0.23.0}/docs/source/LICENSE.md +0 -0
  22. {fotolab-0.22.1 → fotolab-0.23.0}/docs/source/README.md +0 -0
  23. {fotolab-0.22.1 → fotolab-0.23.0}/docs/source/_static/logo.jpg +0 -0
  24. {fotolab-0.22.1 → fotolab-0.23.0}/docs/source/conf.py +0 -0
  25. {fotolab-0.22.1 → fotolab-0.23.0}/docs/source/index.rst +0 -0
  26. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/__main__.py +0 -0
  27. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/subcommands/__init__.py +0 -0
  28. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/subcommands/animate.py +0 -0
  29. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/subcommands/auto.py +0 -0
  30. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/subcommands/border.py +0 -0
  31. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/subcommands/contrast.py +0 -0
  32. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/subcommands/env.py +0 -0
  33. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/subcommands/info.py +0 -0
  34. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/subcommands/montage.py +0 -0
  35. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/subcommands/resize.py +0 -0
  36. {fotolab-0.22.1 → fotolab-0.23.0}/fotolab/subcommands/sharpen.py +0 -0
  37. {fotolab-0.22.1 → fotolab-0.23.0}/noxfile.py +0 -0
  38. {fotolab-0.22.1 → fotolab-0.23.0}/pyproject.toml +0 -0
  39. {fotolab-0.22.1 → fotolab-0.23.0}/tests/__init__.py +0 -0
  40. {fotolab-0.22.1 → fotolab-0.23.0}/tests/conftest.py +0 -0
  41. {fotolab-0.22.1 → fotolab-0.23.0}/tests/test_env.py +0 -0
  42. {fotolab-0.22.1 → fotolab-0.23.0}/tests/test_help_flag.py +0 -0
  43. {fotolab-0.22.1 → fotolab-0.23.0}/tests/test_quiet_flag.py +0 -0
@@ -0,0 +1,5 @@
1
+ 3.9
2
+ 3.10
3
+ 3.11
4
+ 3.12
5
+ 3.13
@@ -7,6 +7,14 @@ and this project adheres to [0-based versioning](https://0ver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## v0.23.0 (2024-12-22)
11
+
12
+ - Add `-cw` or `--clockwise` option to `rotate` subcommand
13
+ - Add `-r` or `--rotation` option to `rotate` subcommand
14
+ - Refactor calculation of position of watermark
15
+ - Refactor setup logging again
16
+ - Use major Python versions for `pyenv`
17
+
10
18
  ## v0.22.1 (2024-12-15)
11
19
 
12
20
  - Fix show all EXIF tags instead of selected fields
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fotolab
3
- Version: 0.22.1
3
+ Version: 0.23.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>
@@ -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,info,resize,rotate,montage,sharpen,watermark,env} ...
64
+ {animate,auto,border,contrast,env,info,montage,resize,rotate,sharpen,watermark} ...
65
65
 
66
66
  A console program to manipulate photos.
67
67
 
@@ -70,19 +70,19 @@ 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,info,resize,rotate,montage,sharpen,watermark,env}
73
+ {animate,auto,border,contrast,env,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
+ env print environment information for bug reporting
79
80
  info info an image
81
+ montage montage a list of image
80
82
  resize resize an image
81
83
  rotate rotate an image
82
- montage montage a list of image
83
84
  sharpen sharpen an image
84
85
  watermark watermark an image
85
- env print environment information for bug reporting
86
86
 
87
87
  options:
88
88
  -h, --help show this help message and exit
@@ -206,7 +206,7 @@ fotolab info -h
206
206
  <!--help-info !-->
207
207
 
208
208
  ```console
209
- usage: fotolab info [-h] [-s] [--camera] IMAGE_FILENAME
209
+ usage: fotolab info [-h] [-s] [--camera] [--datetime] IMAGE_FILENAME
210
210
 
211
211
  positional arguments:
212
212
  IMAGE_FILENAME set the image filename
@@ -215,6 +215,7 @@ options:
215
215
  -h, --help show this help message and exit
216
216
  -s, --sort show image info by sorted field name
217
217
  --camera show the camera maker details
218
+ --datetime show the datetime
218
219
  ```
219
220
 
220
221
  <!--help-info !-->
@@ -228,13 +229,17 @@ fotolab rotate -h
228
229
  <!--help-rotate !-->
229
230
 
230
231
  ```console
231
- usage: fotolab rotate [-h] IMAGE_FILENAMES [IMAGE_FILENAMES ...]
232
+ usage: fotolab rotate [-h] [-r ROTATION] [-cw]
233
+ IMAGE_FILENAMES [IMAGE_FILENAMES ...]
232
234
 
233
235
  positional arguments:
234
- IMAGE_FILENAMES set the image filenames
236
+ IMAGE_FILENAMES set the image filenames
235
237
 
236
238
  options:
237
- -h, --help show this help message and exit
239
+ -h, --help show this help message and exit
240
+ -r, --rotation ROTATION
241
+ Rotation angle in degrees (default: '0')
242
+ -cw, --clockwise Rotate clockwise (default: 'False)
238
243
  ```
239
244
 
240
245
  <!--help-rotate !-->
@@ -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,info,resize,rotate,montage,sharpen,watermark,env} ...
41
+ {animate,auto,border,contrast,env,info,montage,resize,rotate,sharpen,watermark} ...
42
42
 
43
43
  A console program to manipulate photos.
44
44
 
@@ -47,19 +47,19 @@ 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,info,resize,rotate,montage,sharpen,watermark,env}
50
+ {animate,auto,border,contrast,env,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
+ env print environment information for bug reporting
56
57
  info info an image
58
+ montage montage a list of image
57
59
  resize resize an image
58
60
  rotate rotate an image
59
- montage montage a list of image
60
61
  sharpen sharpen an image
61
62
  watermark watermark an image
62
- env print environment information for bug reporting
63
63
 
64
64
  options:
65
65
  -h, --help show this help message and exit
@@ -183,7 +183,7 @@ fotolab info -h
183
183
  <!--help-info !-->
184
184
 
185
185
  ```console
186
- usage: fotolab info [-h] [-s] [--camera] IMAGE_FILENAME
186
+ usage: fotolab info [-h] [-s] [--camera] [--datetime] IMAGE_FILENAME
187
187
 
188
188
  positional arguments:
189
189
  IMAGE_FILENAME set the image filename
@@ -192,6 +192,7 @@ options:
192
192
  -h, --help show this help message and exit
193
193
  -s, --sort show image info by sorted field name
194
194
  --camera show the camera maker details
195
+ --datetime show the datetime
195
196
  ```
196
197
 
197
198
  <!--help-info !-->
@@ -205,13 +206,17 @@ fotolab rotate -h
205
206
  <!--help-rotate !-->
206
207
 
207
208
  ```console
208
- usage: fotolab rotate [-h] IMAGE_FILENAMES [IMAGE_FILENAMES ...]
209
+ usage: fotolab rotate [-h] [-r ROTATION] [-cw]
210
+ IMAGE_FILENAMES [IMAGE_FILENAMES ...]
209
211
 
210
212
  positional arguments:
211
- IMAGE_FILENAMES set the image filenames
213
+ IMAGE_FILENAMES set the image filenames
212
214
 
213
215
  options:
214
- -h, --help show this help message and exit
216
+ -h, --help show this help message and exit
217
+ -r, --rotation ROTATION
218
+ Rotation angle in degrees (default: '0')
219
+ -cw, --clockwise Rotate clockwise (default: 'False)
215
220
  ```
216
221
 
217
222
  <!--help-rotate !-->
@@ -21,7 +21,7 @@ import subprocess
21
21
  import sys
22
22
  from pathlib import Path
23
23
 
24
- __version__ = "0.22.1"
24
+ __version__ = "0.23.0"
25
25
 
26
26
  log = logging.getLogger(__name__)
27
27
 
@@ -32,26 +32,31 @@ log = logging.getLogger(__name__)
32
32
 
33
33
 
34
34
  def setup_logging(args: argparse.Namespace) -> None:
35
- """Set up logging by level."""
36
- if args.verbose == 0:
37
- logging.getLogger("PIL").setLevel(logging.ERROR)
35
+ """Sets up logging configuration based on command-line arguments.
38
36
 
37
+ Args:
38
+ args (argparse.Namespace): Namespace containing parsed arguments.
39
+ """
39
40
  if args.quiet:
40
41
  logging.disable(logging.NOTSET)
41
- else:
42
- level = logging.DEBUG if args.debug else logging.INFO
43
- format_string = (
44
- "[%(asctime)s] %(levelname)s: %(name)s: %(message)s"
45
- if args.debug
46
- else "%(message)s"
47
- )
42
+ return
48
43
 
49
- logging.basicConfig(
50
- level=level,
51
- format=format_string,
52
- stream=sys.stdout,
53
- datefmt="%Y-%m-%d %H:%M:%S",
54
- )
44
+ if args.verbose == 0:
45
+ logging.getLogger("PIL").setLevel(logging.ERROR)
46
+
47
+ level = logging.DEBUG if args.debug else logging.INFO
48
+ format_string = (
49
+ "[%(asctime)s] %(levelname)s: %(name)s: %(message)s"
50
+ if args.debug
51
+ else "%(message)s"
52
+ )
53
+
54
+ logging.basicConfig(
55
+ level=level,
56
+ format=format_string,
57
+ stream=sys.stdout,
58
+ datefmt="%Y-%m-%d %H:%M:%S",
59
+ )
55
60
 
56
61
 
57
62
  def build_parser() -> argparse.ArgumentParser:
@@ -40,6 +40,21 @@ def build_subparser(subparsers) -> None:
40
40
  metavar="IMAGE_FILENAMES",
41
41
  )
42
42
 
43
+ rotate_parser.add_argument(
44
+ "-r",
45
+ "--rotation",
46
+ type=int,
47
+ default=0,
48
+ help="Rotation angle in degrees (default: '%(default)s')",
49
+ )
50
+
51
+ rotate_parser.add_argument(
52
+ "-cw",
53
+ "--clockwise",
54
+ action="store_true",
55
+ help="Rotate clockwise (default: '%(default)s)",
56
+ )
57
+
43
58
 
44
59
  def run(args: argparse.Namespace) -> None:
45
60
  """Run rotate subcommand.
@@ -52,10 +67,14 @@ def run(args: argparse.Namespace) -> None:
52
67
  """
53
68
  log.debug(args)
54
69
 
70
+ rotation = args.rotation
71
+ if args.clockwise:
72
+ rotation = -rotation
73
+
55
74
  for image_filename in args.image_filenames:
56
75
  original_image = Image.open(image_filename)
57
76
  rotated_image = original_image.rotate(
58
- 180,
77
+ rotation,
59
78
  expand=True,
60
79
  )
61
80
  save_image(args, rotated_image, image_filename, "rotate")
@@ -237,19 +237,14 @@ def calc_padding(image, args) -> int:
237
237
 
238
238
  def calc_position(image, text_width, text_height, position, padding) -> tuple:
239
239
  """Calculate the boundary coordinates of the watermark text."""
240
- (position_x, position_y) = (0, 0)
241
-
242
- if position == "top-left":
243
- position_x = 0 + padding
244
- position_y = 0 + padding
245
- elif position == "top-right":
246
- position_x = image.width - text_width - padding
247
- position_y = 0 + padding
248
- elif position == "bottom-left":
249
- position_x = 0 + padding
250
- position_y = image.height - text_height - padding
251
- elif position == "bottom-right":
252
- position_x = image.width - text_width - padding
253
- position_y = image.height - text_height - padding
254
-
255
- return (position_x, position_y)
240
+ positions = {
241
+ "top-left": (padding, padding),
242
+ "top-right": (image.width - text_width - padding, padding),
243
+ "bottom-left": (padding, image.height - text_height - padding),
244
+ "bottom-right": (
245
+ image.width - text_width - padding,
246
+ image.height - text_height - padding,
247
+ ),
248
+ }
249
+
250
+ return positions.get(position, (0, 0))
@@ -1,5 +0,0 @@
1
- 3.9.20
2
- 3.10.15
3
- 3.11.10
4
- 3.12.7
5
- 3.13.0
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