Functions
Generate multiple metadata images
Return descriptors with distinct IDs to expose multiple image variants from one metadata file. In the modern async convention the selected ID arrives as a promise. Use a fixed public inventory rather than unrestricted input. Example context: isolated Next.js 16.x candidate; snippet is partial unless it defines a complete convention file. Lifecycle: documented. Expected behavior / verification: Check both generated URLs and dimensions; the framework signature must be confirmed against the selected package. Source: https://nextjs.org/docs/app/api-reference/functions/generate-image-metadata Exact installed signature, typecheck and framework execution not run.
Formal Syntax & Structure
nextjs syntaxnextjs
generateImageMetadata(); default image function receives idWorking Example
Example Snippetnextjs
import { ImageResponse } from 'next/og'; export function generateImageMetadata(){return [{id:'small',size:{width:64,height:64},contentType:'image/png'},{id:'large',size:{width:128,height:128},contentType:'image/png'}]} export default async function Icon({id}:{id:Promise<string>}){const width=(await id)==='small'?64:128; return new ImageResponse(<div style={{display:'flex'}}>B</div>,{width,height:width})}