Skip to content

Tag: imeta

Overview

The imeta (inline metadata) tag provides metadata about media URLs included in an event's content. It allows clients to enhance the display of media attachments such as images, videos, and other files by providing additional information like dimensions, MIME types, and alternative text.

Specification

PropertyValue
Tag Nameimeta
Defined inNIP-92
Required forGeneral use, especially for events containing media URLs

Format

["imeta", "url <media-url>", "m <mime-type>", "dim <width>x<height>", "blurhash <blurhash-value>", "alt <alt-text>", "x <sha256-hash>", "fallback <fallback-url>", ...]

The imeta tag is variadic, with each entry being a space-delimited key/value pair. Each imeta tag MUST have a url field and at least one other field.

Usage Description

The imeta tag is used to provide metadata about media URLs included in an event's content. Each imeta tag should match a URL in the event content. Clients may replace these URLs with rich previews based on the metadata provided.

The following fields are defined:

  • url: The URL of the media file (required)
  • m: MIME type of the media
  • dim: Dimensions of the media in the format <width>x<height>
  • blurhash: A compact representation of a placeholder for an image
  • alt: Alternative text describing the media
  • x: SHA256 hash of the media as specified in NIP-94
  • fallback: Alternative URL(s) for the media (can be specified multiple times)

There should be only one imeta tag per URL in the content.

Examples

Basic Example

json
["imeta", "url https://example.com/image.jpg", "m image/jpeg", "alt A beautiful sunset"]

Extended Example

json
[
  "imeta",
  "url https://nostr.build/i/my-image.jpg",
  "m image/jpeg",
  "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",
  "x <sha256 hash as specified in NIP 94>",
  "fallback https://nostrcheck.me/alt1.jpg",
  "fallback https://void.cat/alt1.jpg"
]

Client Behavior

Clients should consider the following behaviors:

  1. When uploading files during a new post, clients MAY include this metadata after the file is uploaded and included in the post.
  2. When pasting URLs during post composition, the client MAY download the file and add this metadata before the post is sent.
  3. Clients MAY ignore imeta tags that do not match a URL in the event content.
  4. Clients MAY replace URLs that have matching imeta tags with rich previews based on the metadata.

Relay Behavior

No specific relay behavior is defined for the imeta tag in NIP-92. Relays should treat events with imeta tags like any other event.

References

  • Any tags defined in NIP-94 for file metadata

Notes

The imeta tag is designed to enhance the user experience when displaying media in Nostr clients. It allows for rich previews, accessibility through alt text, and fallback options if the primary URL becomes unavailable.

The tag can include any field specified by NIP-94, making it extensible for various media types and metadata needs.