Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Google’s authentication-less on-the-fly image resizing service

Google's authentication-less on-the-fly image resizing service

I found it while poking around the Google+ HTML. Jotting down some notes felt like a good idea, so here goes. If you know more about this API, let me know, please!

(Word of warning: I spent ~30 minutes on both my experimentation and this here write-up, so it might not be the most thought-provoking, brilliant thing you read today.)

Base URL


  • url: original image URL
  • container: must be "focus" (i dunno lol)
  • 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 panorama picture I took in Istanbul last year.

Make it square, 300x300px:

Make it 750px wide and keep the aspect ration:


At least in Chrome, opening the URL in the browser will force a download of a text file (which is actually a JPG). Putting the URL in an <img> tag is fine. Or just use curl.


This comment has been minimized.

Copy link

edent commented Jan 2, 2015

Really useful! Do you know if there's a way to specify a maximum width? Like, only resize if over X pixels?


This comment has been minimized.

Copy link

pajtai commented Jul 1, 2015

Are there any docs for this service? Tried googling a few things, but didn't find anything.


This comment has been minimized.

Copy link

martijndebruijn commented Dec 29, 2015

@lawloretienne: I have the same problem and I think it is related to the size of the image you want to resize. Try a smaller source image. I don't know what the maximum of the source message is but it looks like something of max 3000px X 3000px.


This comment has been minimized.

Copy link

sw-ms-roshanparmar commented Jan 10, 2018

Hi, it is not working for some of the images. below is the link of image which i used.

and i tried to resize it with the following url:

but, it still gives the image in same resolution. it is not resizing it.
any help ?


This comment has been minimized.

Copy link

Sauerstoffdioxid commented Feb 12, 2018

I've found two more options:

  • no_expand=1: when scaled to a larger size than the image itself is, it will not be resized (e.g. the dimensions set with resize_* act as a maximum but are not forced on smaller images).
    no_expand=0 seems to function as something like "force resize"
  • rewriteMime=image/*: normally the mime type is something like image/png; charset=UTF-8. With this option you can overwrite it. The * functions as a placeholder for whatever mime the image originally had, i. e. rewriteMime=image/* would give image/png if used on a PNG. Note that it won't affect the proxying – you'll still receive the same with or without this option (only the mime type changes)

Some other things:

  • There's a parameter gadget=a, not sure what it's for.
  • Only container and url are required parameters. The value of container=focus is irrelevant as long as it's there.

This comment has been minimized.

Copy link

ShaMan123 commented Apr 11, 2018

does this work?
couldn't get anything to work


This comment has been minimized.

Copy link

Sauerstoffdioxid commented Apr 15, 2018

@ShaMan123 Yes, it should. Here's an example:
Github Icon

EDIT: For some reason, GitHub is pulling the original image. Weird. However, the link below should yield a resized version.



This comment has been minimized.

Copy link

giautm commented Jul 17, 2018

You should use querystring.stringify to encode all params like bellow, or encodeURIComponent to keep original params to url.
Without encoding, all params in this URL will forward to Google rather original service.

        const params = querystring.stringify({
          no_expand: Number(noExpand),
          resize_h: height,
          resize_w: width,

This comment has been minimized.

Copy link

sanealytics commented Jan 30, 2020

This works! Has anyone used this 'at scale'?
I mean, I'm hoping Google does but do they block you if you put it on a busy website?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.