Skip to content

Instantly share code, notes, and snippets.

@Sauerstoffdioxid
Last active April 24, 2024 08:30
Show Gist options
  • Star 33 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save Sauerstoffdioxid/2a0206da9f44dde1fdfce290f38d2703 to your computer and use it in GitHub Desktop.
Save Sauerstoffdioxid/2a0206da9f44dde1fdfce290f38d2703 to your computer and use it in GitHub Desktop.
Google/Blogger Image URL Parameters

Google/Blogger Image URL Parameters

This is an effort to document what is known about Google's (Blogger's/Blogspot's) image URL parameters. Some of these options were taken from existing first or third party documentation (see the links at the end of this document), but the majority is based off my own investigations.

Where to use them?

  • On Blogger's image URL's: 2.bp.blogspot.com/-OF7u67HQE1M/VHc8S8qJTDI/AAAAAAAACxI/UD-11c63diQ/s1600/005.png
  • On just about any googleusercontent image URL: https://lh3.googleusercontent.com/Jvmz11cLrvNIHG_LWjVO9B-UV2IN4Cfk1pycbhWZl6IriMgCAGCOFuBRtoHaiZ6xeVGqCugZcCql=w176-h176-n-o

Replace the bolded parts with the parameters.

The Parameters

# represents numbers; * is used as a wildcard, meaning anything can follow.

Parameters can be combined by joining the with a hyphen, eg. w200-h100-c.

Known Parameters

Resizing

param description
w# specifies the width.
h# specify the height.
s# fit the image into a square of specified size. equivalent to setting w and h to the same value.
nu No Upscaling of files smaller than requested.
s Force the scaling, ignoring the aspect ratio. Requires both w and h to be explicitly set. ignores nu.

Aspect ratio will be preserved by default. Also, nu seems to be set by default for resize-only requests. Setting s, w or h to zero returns the full image.

Cropping

param description
c crop the image
cc circular mask applied over the crop. see also bc# background color option below.
ci does not upscale the image when a larger size is requested, and seems to always return a square crop
p crop with a different focus
pf same as p?
pp same as p?
n similar to the p crop. requires both w and h to be set.
fcrop64=1,aaaabbbbccccdddd free crop. Each block specifies the position of one border (a = left, b = top, c = right, d = bottom). Each hexadecimal value is calculated according to this formula pos = 0xYYYY / 0xFFFF or 0xYYYY = pos * 0xFFFF where 0xYYYY is the hexadecimal value we're looking for and pos is the distance from the top left corner in percent. For instance, fcrop64=1,00008000ffffffff would give you the bottom half of the picture.

I'm not too sure how c and p are different from another. The crop parameters change the "fit into this size" approach from the resizing parameters into "fill this space". Cropping will force a resize even if the image is smaller, unless nu is used.

Editing

param description
fh flip horizontally
fv flip vertically
r# rotate by # degrees (must be one of the following: 90, 180, 270)
ba# adds a little symbol to the bottom right corner (stars, a checkmark, etc). valid range: 0 to 11
br# border radius of #px. (can be used without specifying a border.) see also bc# background color option below.
b# adds a border of #px width in c# color. Does not play well together with other editing parameters.
c# set the color for editing operations that use them (eg. b#). If not set, falls back to white. Accepts hex input: c0xrrggbb or c0xaarrggbb (defaults to transparent)
bc# set the background color for formats that don't support transparency. If not set, falls back to c#, or black. Accepts hex input: bc0xrrggbb or bc0xaarrggbb (defaults to transparent)
pd pads the image to the given size using pc# color
pc set the background color for padded images. If not set, falls back to c#, or black. Accepts hex input: bc0xrrggbb or bc0xaarrggbb (defaults to transparent)
fSoften=a,b,c blurs the image, mixed with the non-blurred image. Parameter a doesn't seem to make any difference, b specifies the blurring amount and c the mix with 0 being all blurred and 100 being the original image

Output Formats

param description
rj forces JPEG output. Does not support transparency. Also see bc# background color above.
rp forces PNG output. (Animated PNG not supported.)
rw forces WebP output. Does support transparency and animation.
rwa forces animated WebP output on animated input.
rg forces GIF output.
rh forces MP4 output. (Intented for GIF conversion.) Does not support transparency. Also see bc# background color above.
nw No WebP. Disables WebP output even if requested with rw. Falls back to the original format.
h HTML output. A simple html file with a single image element the image as specified (adds ft parameter).
g outputs some weird xml file. see Tiled Images below.
fg same as g
pg same as g but encoded as protocol buffer
d force a download of the file.
ft apply lossless compression. Doesn't matter for most cases, as it's automatically applied when the image is processed.
ng probably like ft above, just not quite as efficient.
lo force lossy conversion. Only really useful for webp output, because webp supports both, lossy and lossless modes, and will default to the lossless one for PNG input, ignoring l#.
l# set the quality level for lossy compression formats (jpg, webp). Takes precedence over v#. [it's a lowercase L]
v# also sets the compressions level. # is much more limited, but it seems to automatically apply lo aswell. v0 is the original image quality. v1 equals l60. v2 equals l40. v3 and above equal l20. Only works if an output format is explicitly set.

Compression settings are ignored on any animated output, except for rwa output setting.

Video Specific

param description
no If the file is a video (on Google Photos), this removes the play button from the thumbnail.
o Similar to the above, this will make thumbnails of videos have the play button, overwriting no
m# Video playback. Number matches the YouTube video codes, but only few will actually be available. Working most often: 15: Original (only available if it's actually streamable and original files are preserved [disabled photo optimization in Google Photos]. Requires mp4 I believe), 18: 360p MP4, 22: 720p MP4, 36: 180p 3GP, 37: 1080p MP4, 140: AAC audio-only
dv download a Google-encoded version of the video
mm,* Mostly used to download manifest files for a few streaming technologies. Possible values: mm,dash and mm,hls (note the comma). You can also set any valid video format code using this, see m# regarding those.
vm when used with the above, modifies some response headers. Recommended.

The query parameter title can also be used in conjunction with any valid m# value to download the video with specified title, ie.: https://lh3.googleusercontent.com/[some long hash]=m18?title=aaaa would download a 360p copy called aaaa.mp4. Note that even if I said those m# codes work most often, that doesn't mean they will always be available! Same goes for mm,*, especially with hls.

Various

param description
e# How long the file may be cached by the browser. Number is max-age in days.
ip do not strip meta data
sm strip color profiles
t* used for some kind of authentication on artsandculture.google.com. Otherwise, anything can follow without making any apparent difference. Can be used if your target url is required to have a valid file extension: t.jpg
q* works similar to t*. Don't know it's original purpose.

Unsorted

param description
k disables animations. by default, the first frame is shown. see a# below.
a# if the source is an animation (eg. a GIF), select a certain frame instead. Introduces the play button, see no.

Tiled Images

With the g (or fg) option you can get an xml file containing tiling information. To use the tiling, special parameters x, y and z can be used. x and y specify which tile should be returned. z specifies how far zoomed out the images are. For x and y refer to num_tiles_x and num_tiles_y respectively from the xml. z maps to the index of each pyramid_level, 0 being the most zoomed out.

Unknown Parameters

These are parameters that exist, but where I have no idea what they do or how to correctly use them.

param notes
a
b
r
al
df
gd
il
iv# 0 or 1
lf
md
mo
mv requires a video. not sure what it does or how to use. honestly, not sure. but does not always work on non-video content.
nc
nd
ns
nt0
pa
rwu likely related to webp compression, but does seemingly nothing
sg
sm
fm gives an image of the default avatar
cp#
pc#
sc#
vb#

Sources

Let me know when you find more options, and I will add them here

@Sauerstoffdioxid
Copy link
Author

You could try to see if =m15 does anything, I remember that working if you had uploaded a video compatible with streaming back in the Google+ days.

However, if that doesn't do the trick, I'm afraid you're out of luck.

@YKStepanov
Copy link

Thanks a lot. Your advice works as you expected. It downloads new videos completely, but on older versions of the video it gives an error.

@JelNiSlaw
Copy link

According to official documentation, p is "smart crop" (using face detection)

@jacobion
Copy link

Hello, I want crop image with fcrop64 parameter.
I have an image size 640x64 (10 picture combined by horizontal), i want crop from picture 3 (left 128, top 0, right 192, bottom:0), mean crop one image from 10 image combine.
How to do it.
I don't known calculator left,top,right and bottom to hex value block (aaaa,bbbb,cccd,dddd)
Thanks.

@Sauerstoffdioxid
Copy link
Author

for the left value you'd do the following:
128 / 640 = 0.2
0.2 * 0xFFFF = 0x3333, which is the value you're looking for.

For the right value, you'd start with 192 instead of 128. Since it measures from the top left corner, the top value would be 0x0000 and the bottom value 0xFFFF

@jacobion
Copy link

Thank @Sauerstoffdioxid, 0.2 * 0xFFFF = 0x3333. In php is: hecdex(0.2*0xFFFF) :)

@DharmicDeveloper
Copy link

Hello, when using the resizeImage() function in the xml theme, the image automatically get's converted to jpg from webp. pls help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment