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.
- {fotolab-0.33.0/src/fotolab.egg-info → fotolab-0.33.1}/PKG-INFO +1 -1
- {fotolab-0.33.0 → fotolab-0.33.1}/pyproject.toml +1 -1
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/resize.py +14 -14
- {fotolab-0.33.0 → fotolab-0.33.1/src/fotolab.egg-info}/PKG-INFO +1 -1
- {fotolab-0.33.0 → fotolab-0.33.1}/LICENSE.md +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/README.md +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/setup.cfg +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/__init__.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/__main__.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/cli.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/__init__.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/animate.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/auto.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/border.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/contrast.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/env.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/halftone.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/info.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/montage.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/rotate.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/sharpen.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab/subcommands/watermark.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab.egg-info/SOURCES.txt +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab.egg-info/dependency_links.txt +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab.egg-info/entry_points.txt +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab.egg-info/requires.txt +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/src/fotolab.egg-info/top_level.txt +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_animate_subcommand.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_auto_subcommand.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_border_subcommand.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_contrast_subcommand.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_env_subcommand.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_halftone_subcommand.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_help_flag.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_info_subcommand.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_montage_subcommand.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_quiet_flag.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_resize_subcommand.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_rotate_subcommand.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_sharpen_subcommand.py +0 -0
- {fotolab-0.33.0 → fotolab-0.33.1}/tests/test_watermark_subcommand.py +0 -0
@@ -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
|
-
|
178
|
-
|
179
|
-
log.debug("aspect ratio: %f", aspect_ratio)
|
174
|
+
new_width = args.width
|
175
|
+
new_height = args.height
|
180
176
|
|
181
|
-
|
182
|
-
log.debug("new height: %d", new_height)
|
177
|
+
original_aspect_ratio = old_width / old_height
|
183
178
|
|
184
|
-
if
|
185
|
-
|
186
|
-
|
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
|
-
|
189
|
-
|
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)
|
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
|
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
|