Appearance
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
Property | Value |
---|---|
Tag Name | imeta |
Defined in | NIP-92 |
Required for | General 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 mediadim
: Dimensions of the media in the format<width>x<height>
blurhash
: A compact representation of a placeholder for an imagealt
: Alternative text describing the mediax
: SHA256 hash of the media as specified in NIP-94fallback
: 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:
- When uploading files during a new post, clients MAY include this metadata after the file is uploaded and included in the post.
- When pasting URLs during post composition, the client MAY download the file and add this metadata before the post is sent.
- Clients MAY ignore
imeta
tags that do not match a URL in the event content. - 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
Related Tags
- 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.