fotolab 0.33.0__tar.gz → 0.33.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 (41) hide show
  1. {fotolab-0.33.0/src/fotolab.egg-info → fotolab-0.33.1}/PKG-INFO +1 -1
  2. {fotolab-0.33.0 → fotolab-0.33.1}/pyproject.toml +1 -1
  3. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/resize.py +14 -14
  4. {fotolab-0.33.0 → fotolab-0.33.1/src/fotolab.egg-info}/PKG-INFO +1 -1
  5. {fotolab-0.33.0 → fotolab-0.33.1}/LICENSE.md +0 -0
  6. {fotolab-0.33.0 → fotolab-0.33.1}/README.md +0 -0
  7. {fotolab-0.33.0 → fotolab-0.33.1}/setup.cfg +0 -0
  8. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/__init__.py +0 -0
  9. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/__main__.py +0 -0
  10. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/cli.py +0 -0
  11. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/__init__.py +0 -0
  12. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/animate.py +0 -0
  13. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/auto.py +0 -0
  14. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/border.py +0 -0
  15. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/contrast.py +0 -0
  16. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/env.py +0 -0
  17. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/halftone.py +0 -0
  18. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/info.py +0 -0
  19. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/montage.py +0 -0
  20. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/rotate.py +0 -0
  21. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/sharpen.py +0 -0
  22. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/watermark.py +0 -0
  23. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab.egg-info/SOURCES.txt +0 -0
  24. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab.egg-info/dependency_links.txt +0 -0
  25. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab.egg-info/entry_points.txt +0 -0
  26. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab.egg-info/requires.txt +0 -0
  27. {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab.egg-info/top_level.txt +0 -0
  28. {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_animate_subcommand.py +0 -0
  29. {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_auto_subcommand.py +0 -0
  30. {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_border_subcommand.py +0 -0
  31. {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_contrast_subcommand.py +0 -0
  32. {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_env_subcommand.py +0 -0
  33. {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_halftone_subcommand.py +0 -0
  34. {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_help_flag.py +0 -0
  35. {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_info_subcommand.py +0 -0
  36. {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_montage_subcommand.py +0 -0
  37. {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_quiet_flag.py +0 -0
  38. {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_resize_subcommand.py +0 -0
  39. {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_rotate_subcommand.py +0 -0
  40. {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_sharpen_subcommand.py +0 -0
  41. {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_watermark_subcommand.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fotolab
3
- Version: 0.33.0
3
+ Version: 0.33.1
4
4
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
5
5
  License-Expression: AGPL-3.0-or-later
6
6
  Project-URL: Changelog, https://github.com/kianmeng/fotolab/blob/master/CHANGELOG.md
@@ -7,7 +7,7 @@ where = ["src"]
7
7
 
8
8
  [project]
9
9
  name = "fotolab"
10
- version = "0.33.0"
10
+ version = "0.33.1"
11
11
  authors = [{name = "Kian-Meng Ang", email = "kianmeng@cpan.org"}]
12
12
  requires-python = ">=3.9"
13
13
  readme = "README.md"
@@ -168,26 +168,26 @@ def _resize_image(original_image, args):
168
168
 
169
169
 
170
170
  def _calc_new_image_dimension(image, args) -> tuple:
171
- new_width = args.width
172
- new_height = args.height
173
-
174
171
  old_width, old_height = image.size
175
172
  log.debug("old image dimension: %d x %d", old_width, old_height)
176
173
 
177
- if args.width != DEFAULT_WIDTH:
178
- aspect_ratio = old_height / old_width
179
- log.debug("aspect ratio: %f", aspect_ratio)
174
+ new_width = args.width
175
+ new_height = args.height
180
176
 
181
- new_height = math.ceil(args.width * aspect_ratio)
182
- log.debug("new height: %d", new_height)
177
+ original_aspect_ratio = old_width / old_height
183
178
 
184
- if args.height != DEFAULT_HEIGHT:
185
- aspect_ratio = old_width / old_height
186
- log.debug("aspect ratio: %f", aspect_ratio)
179
+ if new_width != DEFAULT_WIDTH and new_height == DEFAULT_HEIGHT:
180
+ # user provided width, calculate height to maintain aspect ratio
181
+ new_height = math.ceil(new_width / original_aspect_ratio)
182
+ log.debug("new height calculated based on width: %d", new_height)
183
+ elif new_height != DEFAULT_HEIGHT and new_width == DEFAULT_WIDTH:
184
+ # user provided height, calculate width to maintain aspect ratio
185
+ new_width = math.ceil(new_height * original_aspect_ratio)
186
+ log.debug("new width calculated based on height: %d", new_width)
187
187
 
188
- new_width = math.floor(args.height * aspect_ratio)
189
- log.debug("new width: %d", new_width)
188
+ # if both are default, no calculation needed, use defaults
189
+ # due to argparse's mutually exclusive group, it's not possible for both
190
+ # new_width and new_height to be non-default when --canvas is False
190
191
 
191
192
  log.debug("new image dimension: %d x %d", new_width, new_height)
192
-
193
193
  return (new_width, new_height)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fotolab
3
- Version: 0.33.0
3
+ Version: 0.33.1
4
4
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
5
5
  License-Expression: AGPL-3.0-or-later
6
6
  Project-URL: Changelog, https://github.com/kianmeng/fotolab/blob/master/CHANGELOG.md
File without changes
File without changes
File without changes
File without changes