Thumbnail generation#

A thumbnail is produced from a source resource and one specification. This page describes what can trigger generation, what a client can rely on once a request is accepted, how specifications are resolved, and the limits every request is subject to. It does not prescribe how an implementation performs the conversion, where it queues work, or how many components it uses.

This page refers to the operations by role rather than by transport. The generation API is POST /v1alpha/thumbnails over REST and CreateThumbnails over gRPC; the association API is POST /v1alpha/associations / AssociateThumbnail; the association read API is GET /v1alpha/thumbnails / GetThumbnails. Transport-specific request and response shapes are in REST API and gRPC specification.

How generation is triggered#

A client can request generation through the API; implementations MAY also support event-driven generation:

  • Event-driven generation. Generation is triggered by events that reach the service from other systems and services — for example storage notifications, or events delivered through an event broker. No client request is involved: the implementation decides which events are eligible and which specifications to produce (typically a configured default set), and the party that caused the event is not notified directly.

  • On-demand generation. Generation is triggered by a client request to the generation API (POST /v1alpha/thumbnails or CreateThumbnails) naming the source resource_address and, optionally, the specifications wanted. When the client supplies no specifications, the implementation applies its configured defaults, so both flows produce the same thumbnails for the same source.

Whichever flow triggers it, one generation request resolves into one thumbnail per specification, and each thumbnail the implementation produces is recorded as an association between the source and the thumbnail, carrying the fully resolved specification (see Resources, associations, and specifications). From then on the thumbnail is visible through GET /v1alpha/thumbnails and GetThumbnails, and through any change notification the implementation publishes.

What the generation API returns#

An implementation can complete generation synchronously or accept work for later processing. Completion timing is a deployment property, not a request option. Both modes return HTTP 202 Accepted / gRPC OK when at least one specification succeeds:

  • Asynchronous completion: success means the specification was accepted for later processing. A thumbnail need not exist yet, and conversion can still fail later.

  • Synchronous completion: generation, writing the thumbnail, and association complete before the response. Every specification absent from failed completed those steps.

The response contains only failed, with each entry’s fully resolved specification and error_message. An empty list means full success. There is no succeeded field, thumbnail address, or mode marker. Read the source’s associations to obtain the thumbnail resources that have been produced. Do not compare failed.length with the number of specifications sent: omitted or empty specifications expand to the configured defaults.

If every specification fails, both modes return HTTP 502 Bad Gateway / gRPC INTERNAL. Request validation, authentication, and initial source lookup retain their 400/401/403/404 and equivalent gRPC errors. During synchronous completion, a download, conversion, write, or association failure uses the failure list and total-failure rule above. The REST API and gRPC specification pages list every status.

A timeout or lost response does not establish that no work or storage write occurred. The association read API cannot find a thumbnail whose write succeeded but whose association failed. Disassociation removes metadata only; it does not delete the thumbnail resource. The API defines no task identifier or status endpoint and does not guarantee completion after the caller disconnects. Event-driven generation has no corresponding client request or generation response.

Specifications and defaults#

A specification describes one thumbnail. For an IMAGE_TO_IMAGE specification the fields are width, height, encoding_format, transform_type, crop_strategy, and two optional fields, quality and preserve_aspect_ratio. MANUAL specifications describe a thumbnail the caller produced and belong to the association API; the generation API does not generate them, because no conversion takes place (see Resources, associations, and specifications).

A caller MAY omit any optional field. Omission is distinct from an explicit value:

Field

When omitted

specifications

One thumbnail per configured size, using every configured processing default

quality

The deployment’s configured default quality is applied

preserve_aspect_ratio

The deployment’s configured default is applied; an explicit false is honored as false

The specification an implementation acts on is always complete. Configuration-derived and caller-supplied values are indistinguishable on the wire, and the stored association records the resolved values, so reading an association back returns the specification that was actually used.

Which source formats an implementation can decode, which encodings it produces, and how it realizes each transform_type and crop_strategy are properties of the implementation, not of this specification. The reference implementation documents its own in the Thumbnail Service documentation (Generation pipeline).

Where thumbnails are written#

The implementation chooses the destination address of every thumbnail; callers do not choose it and cannot override it per request. The destination MUST be a deterministic function of the source resource_address, the source resource_identity, and the resolved specification, so that:

  • the same source, identity, and specification always resolve to the same destination, and regenerating a thumbnail overwrites the previous one rather than accumulating copies;

  • whether a new version of a source produces a new thumbnail address or overwrites the old one is the implementation’s choice — whether it folds the source identity into the destination. The association read API always reports the address that was actually written.

An implementation writes to the destination it resolved and nothing else. A generated thumbnail is itself a storage resource, so an event-driven implementation needs to recognize its own output and not generate thumbnails of thumbnails.

Limits#

Limit

Value

Violation

width, height

1..=8192 inclusive

400 Bad Request / INVALID_ARGUMENT, before the source is looked up

quality for JPEG and WEBP

1..=100 inclusive

400 Bad Request / INVALID_ARGUMENT, before the source is looked up

quality for PNG and GIF

not range-checked

—

Specifications per generation request

at most 1000

400 Bad Request / INVALID_ARGUMENT, before the source is looked up

resource_address

required, non-blank (the schema advertises a 2048-character maximum)

400 Bad Request / INVALID_ARGUMENT when blank; a longer address is resolved against storage and fails with 404 / NOT_FOUND if it does not exist

One invalid specification rejects the whole request: nothing is accepted until every specification passes, so the caller can correct its input without leaving partial work behind. Source images are additionally bounded by the implementation — typically by encoded size, decoded pixel count, and peak conversion memory. A source that exceeds those bounds produces no thumbnail; under synchronous completion the failure is reported in failed or as the existing 502 Bad Gateway / INTERNAL total-failure response. Under asynchronous completion a later processing failure is not returned through the generation API; clients query associations for completed results.

See next#