[Zope] Photo: somes issues and thoughts

Ron Bickers rbickers-dated-1010770951.13a5be@logicetc.com
Fri, 4 Jan 2002 12:42:30 -0500


> -----Original Message-----
> From: J M Cerqueira Esteves [mailto:jmce@artenumerica.com]

> Meanwhile, here is the new _getAspectRatioSize I am using, in case
> you wish to replace the current "official" one with it:
>
>     def _getAspectRatioSize(self, width, height):
>         """Return proportional dimensions within desired size."""
>         img_width, img_height = self.width(), self.height()
>         sw = float (width) / img_width
>         sh = float (height) / img_height
>         if sw <= sh:
>             height = int (sw * img_height + 0.5)
>         else:
>             width = int (sh * img_width + 0.5)
>         return (width, height)
>
>
> Now ALL images resized with ImageMagick have one of the sides exactly
> equal to the maximum specified (with the previous _getAspectRatioSize
> they sometimes came with one pixel less, as I explained on the first
> message).

Wow again.  This is all fascinating.  In case anyone was wondering, the
aspect ratio algorithm I use in Photo was taken basically verbatim from the
old Photo product.  I checked that it was "reasonable" (it was) and I didn't
give it much thought after that.  Now that my brain is fried, does anyone
have any objections to using the above algorithm?

Quite frankly, I don't really care. :-) All of my many hundreds of Photos
look fine to me.  Of course, I'm not the only one using Photo anymore.  Its
trivial to change, and if it's sometimes better but never worse, I'll do it.

_______________________

Ron Bickers
Logic Etc, Inc.