[Zope] Photo: somes issues and thoughts

J M Cerqueira Esteves jmce@artenumerica.com
Fri, 4 Jan 2002 15:41:55 +0000


* J M Cerqueira Esteves <jmce@artenumerica.com> [2002-01-04 15:07 +0000]:
> * Jose' Sebrosa <sebrosa@artenumerica.com> [2002-01-04 13:29 +0000]:
> > Sometimes, truncation (floor) gives better aspect ratio than round.  I would
> > even not be surprised if, statistically, none of the methods were better.
> > 
> > Two examples:
> > 
> > 1-
> > Initial size: 51x49
> > Scale: 1/10
> > Final size (method=round): 5x5
> > Final size (method=floor): 5x4
> > Best method: round
> > 
> > 2-
> > Initial size: 54x56
> > Scale: 1/10
> > Final size (method=round): 5x6
> > Final size (method=floor): 5x5
> > Best method: floor
> 
> Those methods are not used by Photo and ImageMagick. 

Correction: ImageMagick uses the "round" method as above in some cases, 
for instance when one uses 

  convert --geometry 10%x10%  original.png scaled.png

or even

  convert --geometry 10% original.png scaled.png

In this case it seems that both directions are treated separately
and we find the problem above.


In any case I have been talking of `convert' as it is run by Photo, with final
max sizes instead of percent scales:

  convert --geometry 5x6  original.png scaled.png

In this case `convert' tries to respect the aspect ratio, unless one follows
the geometry argument with '!', in which case the image is distorted
as needed.   

So, if some day Photo objects accepts a scale argument as in 

     image.tag (..., scale=0.1, ..)  

or

     http://..../image?scale=0.1

it could be best NOT to call convert with the corresponding percentage argument
but to precalculate new dimensions (W,H) in Photo.py and use
convert -geometry WxH.   

Oh well, too many one-pixel thoughts for one day... :-)