[Clipart] thumbnails size

Glenn Randers-Pehrson <glennrp> glennrp at comcast.net
Wed Sep 1 12:10:22 PDT 2004


Bryce Harrington wrote:
> 
> On Wed, 1 Sep 2004, Jeremy C. Reed wrote:
> > But an idea would be to use some ImageMagick tool or other to crop out the
> > 80x80 section from middle of every PNG.
> >
> > Maybe like:
> >
> > convert -crop 80x80+1+1
> > (but I don't know how to get it from the center.)
> 
> Erf, I don't think that'd produce very good results...  E.g. if the
> giraffe thumbnail cut off its head and feet, then I think people would
> assume the svg was busted and wouldn't download it.
> 
> A better algorithm would calculate the expected height and width prior
> to rendering, then
>    if height > 80 and height x width > 80 x 80, use -h 80
>    else use -w 80
> Or something like that (maybe we could fudge to allow height up to 100
> before limiting it.
> 

There are a lot of ways of cropping supported directly by ImageMagick.

You could scale the image to 80x80 with border strips on either the
top and bottom or on the sides, depending on the aspect ratio of the
source:

  convert source.png -bordercolor white -border 40x40 -resize 160x160 \
          -gravity center -crop 80x80+0+0 thumbnail.png



More information about the clipart mailing list