get_thumbnail_dimensions_from_image()
September 1, 2008 5:47 PM Subscribe
Can one find the coordinates (x,y,height,width) of a thumbnail taken out of the original image, programmatically?
I run a highly dynamic photo sharing website that takes thumbnails of the photos that users upload. It automatically uses the center of the photo as the thumbnail, 75px by 75px, but users can change it with a handy javascript applet. They can make the thumbnailified area bigger, but it forces them to keep the 1:1 ratio, and it's downsized if it is bigger than 75x75.
So here in lies the rub: I'm pushing a redesign, and the thumbnails are now 100x100. I was dumb and did not log the thumbnail dimensions. I'd really really really like those numbers, not only to make the thumbnails bigger and look less blurry, because I know we'll also eventually be printing these out, and I'm going to want a sharper image to send to the printer.
The big question: Can I get, with some software, the x, y, h, and w of the thumbnail with some sort of fuzzy image comparison? Can image magick do this? My language of choice is python, so anything using that will be cake.
posted by Mach5 to computers & internet (10 answers total) 1 user marked this as a favorite
At the least, you've got to compare every 75x75 px region of a photo with the saved thumbnail. However, lots of people are likely to have chosen a larger area, so you really need to compare EVERY region, scaled to 75x75, with the thumbnail. Very doable, but also very expensive (unless you have a very small number of images).
Better just to stick with the small thumbnails for old content and go 100x100 for new. Also, store the thumbnail coordinates in your image metadata so that you don't have this problem when you move up to 150x150...
posted by b1tr0t at 5:52 PM on September 1, 2008