* marc lindahl <marc@bowery.com> [2002-01-04 01:54 +0000]:
From: J M Cerqueira Esteves <jmce@artenumerica.com>
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 / h0 [I had a mistake here, /w0 instead of /h0]
Look at the order of operations - the truncation doesn't hurt anything.
I believe you are mentioning that h0*wM/w0 == (h0*wM)/w0 == int (float(h0*wM) / w0) instead of the (much worse) h0 * (wM/w0)... I was aware of that. The main difference is that Photo defines new dimensions with integer truncation, while Image Magick rounds each to the nearest integer (when results of both calculations are different, the aspect ratio is closer to the original with Image Magick).