NYCPHP Meetup

NYPHP.org

[nycphp-talk] Autodetecting a Portion of an Image for a Thumbnail

Rob Marscher rmarscher at beaffinitive.com
Thu Dec 2 11:22:16 EST 2010


On Dec 2, 2010, at 10:41 AM, Randal Rust wrote:
> I have seen at least 2 apps, one being
> WordPress, that automatically generate a square thumbnail for an image
> from an area on the image that doesn't start with coordinates at the
> top left of the original image. How does it do that?

I'm not sure about wordpress specifically... but there's an imagemagick example for using the "gravity" option to crop the image in different places.  A "north" value tends to work well for profile/avatar images because usually the head is near the top of the image.  http://www.imagemagick.org/Usage/thumbnails/

So I guess, you could automatically do it for the person, and then give them the option to change it and specify their own thumbnail if they don't like it.




More information about the talk mailing list