Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 1.71 KB

01.md

File metadata and controls

57 lines (41 loc) · 1.71 KB

DIP-01

Image Metadata

draft optional author:jb55

Image metadata is additional information associated with urls in notes that clients can use to provide a better experience when loading images.

Image metadata is an imeta tag that looks like this:

{
  "content": "More image metadata tests don’t mind me https://nostr.build/i/863321bb1ae68830ebcf9a343ca0a5e0ce2323d0a55b7fbe86f7a886cf61db8d.jpg ",
  "kind": 1,
  "tags": [
    [
      "imeta",
      "url https://nostr.build/i/863321bb1ae68830ebcf9a343ca0a5e0ce2323d0a55b7fbe86f7a886cf61db8d.jpg",
      "blurhash eVF$^OI:${M{o#*0-nNFxakD-?xVM}WEWB%iNKxvR-oetmo#R-aen$",
      "dim 3024x4032"
      "alt A scenic photo overlooking the coast of Costa Rica"
    ]
  ]
}

There can be multiple imeta tags for each image url in the content.

The imeta tag MUST have a url, and MUST have at least one piece of metadata (blurhash, dim, etc). Otherwise it is invalid.

Fields

imeta can have the following metadata fields:

  • blurhash: A small hash representing a blurred version of the photo. This can be used to create blurry previews before the image is displayed.

  • dim: The dimensions of the image. You can use the aspect ratio of the dimensions to properly size the blurhash

  • sha256: The sha256 hash of the image. This can be used to detect if the content changes.

  • alt: Accessible text label for the vision-impaired or text clients.

Recommended client behavior

When uploading images during a new post, clients can include this metadata after the image is uploaded and included in the post.

When pasting urls during post composition, the client could download the image and add this metadata before the post is sent.