Image

Info

The info for any image is a part of JSON objects containing information about the image in various resolutions and a blur-hash version for the loading placeholder.

An image might be a straight image with only a reference with the original image, or a responsive image. A responsive image has multiple references in the property sources which is a dictionary of size + reference of each responsive images, while a single image has only 1.

Schema versions

Schema v2

type SwarmImage = {
  /** Image aspect ratio (width / height) */
  aspectRatio: number
  /** Blurhash value  */
  blurhash: string
  /** Sources of image in different resolutions */
  sources: Array<{
    /** Image scaled width */
    width: number
    /** Image type */
    type: "jpeg" | "png" | "webp" | "avif"
    /** Image path */
    path: string
  }>
}

Each source must have either path or reference field.

example:

Schema v1

sources field example

At this point in time every image generated is a responsive image (user avatar, user cover, video thumbnail).

Last updated