From: J M Cerqueira Esteves <jmce@artenumerica.com> Organization: Arte Numerica Date: Fri, 4 Jan 2002 07:21:39 +0000 To: zope@zope.org Cc: sebrosa@artenumerica.com Subject: Re: [Zope] Photo: somes issues and thoughts
* J M Cerqueira Esteves <jmce@artenumerica.com> [2002-01-04 06:40 +0000]:
while Photo uses (with integer division, therefore with truncation everywhere):
if hM > h0 * wM / w0: height = h0 * wM / w0 width = wM else: height = hM width = w0 * hM / w0
... which by the way has idempotency problems. In my example, a 272×281 pic allowed to have wM=480 and hM=480, this gives 464×480 as dimensions respecting the original aspect ratio. But if one specifies (wM, hM)=(464,480) and starts again with 272×281, the final result is then (464, 479) instead of the expected (464,480)...
The last line is wrong: width = h0 * hM / w0 But as for float vs fix, I think if you do the same calculation with float you'll still get the same result after you int.