Greetings,
The (very) short
patch below corrects some issues I have had in PIL using the thumbnail method in
certain, admittedly pathological conditions. When aspect ratios are large
enough and one dimension is small enough, it is possible to get these lines to
go to zero and pass zeros through to draft().
I'm not an expert on
the finer points of graphics processing, so this may not be the most correct
solution.
Regards,
Gene
---
Image.py.orig Thu Feb 3 17:42:43
2005
+++ Image.py Thu Feb 3 17:32:40 2005
@@ -1420,8 +1420,8 @@
# preserve aspect ratio
x, y = self.size
- if x > size[0]: y = y * size[0] / x; x = size[0]
- if y > size[1]: x = x * size[1] / y; y = size[1]
+ if x > size[0]: y = (y * size[0] / x) or 1; x = size[0]
+ if y > size[1]: x = (x * size[1] / y) or 1; y = size[1]
size = x, y
if size == self.size:
+++ Image.py Thu Feb 3 17:32:40 2005
@@ -1420,8 +1420,8 @@
# preserve aspect ratio
x, y = self.size
- if x > size[0]: y = y * size[0] / x; x = size[0]
- if y > size[1]: x = x * size[1] / y; y = size[1]
+ if x > size[0]: y = (y * size[0] / x) or 1; x = size[0]
+ if y > size[1]: x = (x * size[1] / y) or 1; y = size[1]
size = x, y
if size == self.size:
_______________________________________________ Image-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/image-sig
