fotolab 0.33.0__py3-none-any.whl → 0.33.2__py3-none-any.whl
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/__init__.py +2 -18
- fotolab/__main__.py +0 -1
- fotolab/subcommands/resize.py +14 -14
- {fotolab-0.33.0.dist-info → fotolab-0.33.2.dist-info}/METADATA +2 -1
- {fotolab-0.33.0.dist-info → fotolab-0.33.2.dist-info}/RECORD +9 -9
- {fotolab-0.33.0.dist-info → fotolab-0.33.2.dist-info}/WHEEL +0 -0
- {fotolab-0.33.0.dist-info → fotolab-0.33.2.dist-info}/entry_points.txt +0 -0
- {fotolab-0.33.0.dist-info → fotolab-0.33.2.dist-info}/licenses/LICENSE.md +0 -0
- {fotolab-0.33.0.dist-info → fotolab-0.33.2.dist-info}/top_level.txt +0 -0
fotolab/__init__.py
CHANGED
@@ -45,12 +45,10 @@ def save_gif_image(
|
|
45
45
|
"loop": 0,
|
46
46
|
"optimize": True,
|
47
47
|
}
|
48
|
-
|
49
|
-
args, original_image, image_filepath, subcommand, **gif_kwargs
|
50
|
-
)
|
48
|
+
save_image(args, original_image, image_filepath, subcommand, **gif_kwargs)
|
51
49
|
|
52
50
|
|
53
|
-
def
|
51
|
+
def save_image(
|
54
52
|
args: argparse.Namespace,
|
55
53
|
image: Image.Image,
|
56
54
|
output_filepath: Path,
|
@@ -74,20 +72,6 @@ def _save_image_with_options(
|
|
74
72
|
_open_image(new_filename)
|
75
73
|
|
76
74
|
|
77
|
-
def save_image(
|
78
|
-
args: argparse.Namespace,
|
79
|
-
new_image: Image.Image,
|
80
|
-
output_filepath: Path,
|
81
|
-
subcommand: str,
|
82
|
-
) -> None:
|
83
|
-
"""Save image after image operation.
|
84
|
-
|
85
|
-
Returns:
|
86
|
-
None
|
87
|
-
"""
|
88
|
-
_save_image_with_options(args, new_image, output_filepath, subcommand)
|
89
|
-
|
90
|
-
|
91
75
|
def _get_output_filename(
|
92
76
|
args: argparse.Namespace, image_file: Path, subcommand: str
|
93
77
|
) -> Path:
|
fotolab/__main__.py
CHANGED
fotolab/subcommands/resize.py
CHANGED
@@ -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)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fotolab
|
3
|
-
Version: 0.33.
|
3
|
+
Version: 0.33.2
|
4
|
+
Summary: A console program to manipulate photos.
|
4
5
|
Author-email: Kian-Meng Ang <kianmeng@cpan.org>
|
5
6
|
License-Expression: AGPL-3.0-or-later
|
6
7
|
Project-URL: Changelog, https://github.com/kianmeng/fotolab/blob/master/CHANGELOG.md
|
@@ -1,5 +1,5 @@
|
|
1
|
-
fotolab/__init__.py,sha256=
|
2
|
-
fotolab/__main__.py,sha256=
|
1
|
+
fotolab/__init__.py,sha256=IJXouBpHQPUSSB2Hrev5CPxWEdU73GkIwuVBvdxvrJA,3114
|
2
|
+
fotolab/__main__.py,sha256=Wk11t_zKs3wJ-okM3yv7Mtj1pRwQZu3NCmpteBwn4Hs,810
|
3
3
|
fotolab/cli.py,sha256=oFiQXmsu3wIsM_DpZnL4B94sAoB62L16Am-cjxGmosY,4406
|
4
4
|
fotolab/subcommands/__init__.py,sha256=l3DlIaJ3u3jGjnC1H1yV8LZ_nPqOLJ6gikD4BCaMAQ0,1129
|
5
5
|
fotolab/subcommands/animate.py,sha256=iEor831HVQtQ04Y2-kHxnU4--BfS75mXggVIblxrO6g,5881
|
@@ -10,13 +10,13 @@ fotolab/subcommands/env.py,sha256=QoxRvzZKgmoHTUxDV4QYhdChCpMWs5TbXFY_qIpIQpE,14
|
|
10
10
|
fotolab/subcommands/halftone.py,sha256=56RRkyIhCyc6MPBujV2PIbuR9HobuFhqVQaq58A5ivQ,6781
|
11
11
|
fotolab/subcommands/info.py,sha256=H3voMi67cKoHT2Mu4RUNQBPdb_MspetPjhOvy-YyNnE,3563
|
12
12
|
fotolab/subcommands/montage.py,sha256=ax-TG5FixBRFHPGkVTq8kOtRL900K6nujeBYHZ0yBAE,2622
|
13
|
-
fotolab/subcommands/resize.py,sha256=
|
13
|
+
fotolab/subcommands/resize.py,sha256=d1-_xoTB8Vf62bm7H_9MfXrMaJhlzLiUbePgTdYzaKs,5816
|
14
14
|
fotolab/subcommands/rotate.py,sha256=-yZ7pNW7PDOPBWbKPDut9z8bBe1NocfVBV_6V6tqq-4,2945
|
15
15
|
fotolab/subcommands/sharpen.py,sha256=vGBJHHHUaQ2_SHS-E1mHfNVIfnnNYcCk5ritajWTik8,3594
|
16
16
|
fotolab/subcommands/watermark.py,sha256=BkUa1tH86Ii_u03ypj9Tm0u9v7s9y9Jiz3aLpjmFDb8,11355
|
17
|
-
fotolab-0.33.
|
18
|
-
fotolab-0.33.
|
19
|
-
fotolab-0.33.
|
20
|
-
fotolab-0.33.
|
21
|
-
fotolab-0.33.
|
22
|
-
fotolab-0.33.
|
17
|
+
fotolab-0.33.2.dist-info/licenses/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
18
|
+
fotolab-0.33.2.dist-info/METADATA,sha256=FSxPx0SV3Pbjy8ViHYTC9Yojsary_ILD2-YnbjfLHJY,14814
|
19
|
+
fotolab-0.33.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
20
|
+
fotolab-0.33.2.dist-info/entry_points.txt,sha256=0e1go9plFpqj5FP-OpV2acxTAx3ViI59PMXuhejvgcQ,45
|
21
|
+
fotolab-0.33.2.dist-info/top_level.txt,sha256=XUJ3gdpsbjohoZCLdVlbQrxAUDkbQg7WwGQG2DaN0t4,8
|
22
|
+
fotolab-0.33.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|