Did you know Google runs a free and open image resizing service? I certainly didn’t.
While lazily poking around the Google+ HTML I found an interesting thing: for resizing post images on the fly, G+ uses an open API endpoint. That might come in handy at some point in the future when prototyping this or that, so jotting down some notes felt like a good idea.
If you know more about this API, let me know, please! (See the sidebar for options.)
A word of warning before I progress: I’ve spent ~45 minutes on both my experimentation and this here write-up, maybe an hour. You’ve been warned.
url: original image URL
container: must be “focus”
refresh: time (in seconds) to cache it on G’s servers
resize_w: width in pixels
resize_h: height in pixels
You can either specify both
resize_* parameters or just one.
Let’s resize that big 5831×1644 panorama picture I took in Istanbul a while ago.
Make it square, 300x300px and cache it for 30 days:
Make it 650px wide, keep the aspect ratio and cache the result for a year:
At least in Chrome, opening the URL in the browser will force the download of a
p.txt file (which is actually a JPG). Putting the URL in an
<img> tag is fine, tho. Or just use
curl to save it locally.