所有 App Engine 图像服务 get_serving_url() URI 选项的列表 [英] List of all the App Engine images service get_serving_url() URI options

查看:12
本文介绍了所有 App Engine 图像服务 get_serving_url() URI 选项的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在回答

<小时>

尺寸/裁剪

  • s640 —生成最大尺寸 640 像素的图像
  • s0 —原始大小的图像
  • w100 —生成 100 像素宽的图像
  • h100 —生成 100 像素高的图像
  • s(没有值)—拉伸图像以适应尺寸
  • c —将图像裁剪为提供的尺寸
  • n —与c相同,但从中心裁剪
  • p —智能方形裁剪,尝试裁剪面部
  • pp —备用智能方形裁剪,不会剪掉人脸 (?)
  • 抄送 —生成圆形裁剪的图像
  • ci —方形裁剪到最小的:宽度、高度或指定的 =s 参数
  • nu —没有升级.禁止将图像大小调整为大于其原始分辨率.

平移和缩放

  • x、y、z: —平移和缩放平铺图像.这些对未处理的图像或没有某种形式的授权参数没有影响(请参阅 googleartproject.com).

旋转

  • fv —垂直翻转
  • fh —水平翻转
  • r{90, 180, 270} —将图像顺时针旋转 90、180 或 270 度

图片格式

  • rj — 强制生成的图像为 JPG
  • rp — 强制生成的图像为 PNG
  • rw — 强制生成的图像为 WebP
  • rg — 强制生成的图像为 GIF

  • v{0,1,2,3}将图像设置为不同的格式选项(适用于 JPG 和 WebP)

强制 PNG、WebP 和 GIF 输出可以与圆形裁剪结合使用以获得透明背景.强制JPG可以结合边框颜色来填充透明图片的背景.

动画 GIF

  • rh —从输入图像生成 MP4
  • k —杀死动画(生成静态图像)

杂项.

  • b10 —为图像添加一个 10 像素的边框
  • c0xAARRGGBB —设置边框颜色,例如.=c0xffff0000 代表红色
  • d —添加标题以导致浏览器下载
  • e7 —将响应时的缓存控制 max-age 标头设置为 7 天
  • l100 —将 JPEG 质量设置为 100% (1-100)
  • h —以包含图像的 HTML 页面响应
  • g —使用 Google 平移/缩放使用的 XML 进行响应

过滤器

  • fSoften=1,100,0: - 其中 100 可以从 0 到 100 以模糊图像
  • fVignette=1,100,1.4,0,000000 其中 100 控制渐变的大小,000000 是边框阴影颜色的 RRGGBB
  • fInvert=0,1 无论提供的值如何,都会反转图像
  • fbw=0,1无论提供的值如何,都会使图像变为黑白

未知参数

已经看到这些参数在使用中,但它们的作用未知:no, nd, mv

注意事项

某些选项(例如 =l 表示 JPEG 质量)似乎不会生成新图像.如果您更改另一个选项(大小等)并更改 l 值,则质量更改应该是可见的.某些选项也不能很好地协同工作.谷歌没有记录这一切,这可能是有充分理由的.

此外,永远依赖这些选项中的任何一个都可能不是一个好主意.Google 可以随时删除其中大部分内容,恕不另行通知.

In response to another question, a commenter mentioned an undocumented URI option I was not aware of to flip images horizontally/vertically with the App Engine images service.

The documentation mentions a few basic options:

  • =s0 — fullsize
  • =s640 — longest edge 640px long
  • =s640-c — 640px square

Would be nice to generate a comprehensive list of options, or if someone could provide any more options they know about here to serve as de facto documentation.

解决方案

Between reading some random posts and manually doing some investigative research, I have put together the following list. Please drop any other knowledge in other answers or in comments and I can integrate it here.

Usage Example

We can effect various image transformations by tacking strings onto the end of an App Engine blob-based image URL, following an = character. Options can be combined by separating them with hyphens, eg.:

http://[image-url]=s200-fh-p-b10-c0xFFFF0000

or:

http://[image-url]=s200-r90-cc-c0xFF00FF00-fSoften=1,20,0:

... which have the following effect (documentation below):

As an example of how awesome this is, here's an animated GIF, downsized and inverted:

… which we can then convert into an MP4 video with one extra parameter: click to see MP4 version


SIZE / CROP

  • s640 — generates image 640 pixels on largest dimension
  • s0 — original size image
  • w100 — generates image 100 pixels wide
  • h100 — generates image 100 pixels tall
  • s (without a value) — stretches image to fit dimensions
  • c — crops image to provided dimensions
  • n — same as c, but crops from the center
  • p — smart square crop, attempts cropping to faces
  • pp — alternate smart square crop, does not cut off faces (?)
  • cc — generates a circularly cropped image
  • ci — square crop to smallest of: width, height, or specified =s parameter
  • nu — no-upscaling. Disables resizing an image to larger than its original resolution.

PAN AND ZOOM

  • x, y, z: — pan and zoom a tiled image. These have no effect on an untiled image or without an authorization parameter of some form (see googleartproject.com).

ROTATION

  • fv — flip vertically
  • fh — flip horizontally
  • r{90, 180, 270} — rotates image 90, 180, or 270 degrees clockwise

IMAGE FORMAT

  • rj — forces the resulting image to be JPG
  • rp — forces the resulting image to be PNG
  • rw — forces the resulting image to be WebP
  • rg — forces the resulting image to be GIF

  • v{0,1,2,3}sets image to a different format option (works with JPG and WebP)

Forcing PNG, WebP and GIF outputs can work in combination with circular crops for a transparent background. Forcing JPG can be combined with border color to fill in backgrounds in transparent images.

ANIMATED GIFs

  • rh — generates an MP4 from the input image
  • k — kill animation (generates static image)

MISC.

  • b10 — add a 10px border to image
  • c0xAARRGGBB — set border color, eg. =c0xffff0000 for red
  • d — adds header to cause browser download
  • e7 — set cache-control max-age header on response to 7 days
  • l100 — sets JPEG quality to 100% (1-100)
  • h — responds with an HTML page containing the image
  • g — responds with XML used by Google's pan/zoom

Filters

  • fSoften=1,100,0: - where 100 can go from 0 to 100 to blur the image
  • fVignette=1,100,1.4,0,000000 where 100 controls the size of the gradient and 000000 is RRGGBB of the color of the border shadow
  • fInvert=0,1 inverts the image regardless of the value provided
  • fbw=0,1 makes the image black and white regardless of the value provided

Unknown Parameters

These parameters have been seen in use, but their effect is unknown: no, nd, mv

Caveats

Some options (like =l for JPEG quality) do not seem to generate new images. If you change another option (size, etc.) and change the l value, the quality change should be visible. Some options also don't work well together. This is all undocumented by Google, probably with good reason.

Moreover, it's probably not a good idea to depend on any of these options existing forever. Google could remove most of them without notice at any time.

这篇关于所有 App Engine 图像服务 get_serving_url() URI 选项的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆