Skip to content

Image pipeline

An image pipeline resizes and re-encodes images per device, emits srcset/sizes, and often adds lazy loading and a blur placeholder. In principle this item affects LCP more than FCP.

03 / 14First-paint leverOne of 7 features that affect first paint, the moment the browser first draws content. Together they are worth 14 of the 28 points.

Labels across 23 frameworks

  • 1st-party9
  • Experimental0
  • Third-party14
  • Manual0
  • of 23

How to enable it, by framework

One card per framework, in the same order on every feature page. Where a framework has no built-in support (Manual), a short example shows how to build it yourself.

Next

1st-party2 ptsOverview

Use next/image plus the built-in optimizer, priority on the first ten covers (deprecated in v16 in favour of preload), sizes, and placeholder="blur" fed by ThumbHash data URIs generated by this port's own code.

<Image
  alt={title}
  blurDataURL={thumbhash ? createPngDataUri(thumbhash) : undefined}
  fill
  placeholder={thumbhash ? 'blur' : 'empty'}
  priority={priority}
  sizes={sizes}
  src={resolved}
/>

From this repo's next-books/features/book/components/book-cover.tsx (some props omitted).

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

getImageProps() returns per-breakpoint props; you hand-write the <picture> and <source> elements (hence 🔧). getImageProps() is stable (v14.1.0) and the built-in optimizer already negotiates AVIF/WebP from the Accept header; this row scores only whether the framework emits a <picture> for you.

const {
  props: { srcSet: desktop },
} = getImageProps({ ...common, width: 1440, height: 875, quality: 80, src: '/desktop.jpg' })
const {
  props: { srcSet: mobile, ...rest },
} = getImageProps({ ...common, width: 750, height: 1334, quality: 70, src: '/mobile.jpg' })

return (
  <picture>
    <source media="(min-width: 1000px)" srcSet={desktop} />
    <source media="(min-width: 500px)" srcSet={mobile} />
    <img {...rest} style={{ width: '100%', height: 'auto' }} />
  </picture>
)

Adapted from the image docs, where common is { alt: 'Art Direction Example', sizes: '100vw' }.

Nuxt

1st-party2 ptsOverview

Install @nuxt/image (separate official module) and use <NuxtImg preload> on the first covers.

modules: ['@nuxt/image'],
image: {
  provider: isCloudflare ? 'none' : 'auto',
  quality: 82,
},
<NuxtImg :src="source" :sizes="sizes" :preload="priority" :width="400" :height="600" />

From this repo's nuxt-books/nuxt.config.ts (nuxt-books-optimized-max branch) and app/components/BookCover.vue (optimized branch; some props and options omitted).

Art direction with <picture>

1st-party

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

<NuxtPicture> serves modern formats with a fallback via @nuxt/image; its docs say it does not support multiple image sources, so no breakpoint art direction.

<NuxtPicture
  format="avif,webp"
  src="/nuxt-icon.png"
/>

From the NuxtPicture docs.

SvelteKit

1st-party2 ptsOverview

The framework offers @sveltejs/enhanced-img, a build-time plugin that only optimizes image files present at build. For remote images such as this port's covers the same page points to a CDN and names the community @unpic/svelte, so this port uses Unpic transforms plus an ipx handler (src/lib/server/ipx-handler.ts), disabled on Cloudflare. adapter-vercel also has an images option (not used here). To use the first-party route for local files:

enhancedImages(), // must come before the SvelteKit plugin
<enhanced:img src="./path/to/your/image.jpg" alt="An alt text" />

Adapted from the images docs.

Art direction with <picture>

1st-party

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

enhanced:img (local files only) is replaced at build time by an <img> wrapped in a <picture> with multiple formats and sizes; that is modern formats, not breakpoint art direction. Setup is the plugin line shown in section 3:

<enhanced:img src="./path/to/your/image.jpg" alt="An alt text" />

From the images docs.

SolidStart

1st-party2 ptsOverview

The Solid team publishes @solidjs/image (npm latest 1.0.0 for Solid 2; 0.x for Solid 1): a SolidImage component plus imagePlugin from @solidjs/image/vite, which resizes and re-encodes local images at build time with sharp, emits srcset, lazy-loads, and supports blur/BlurHash/ThumbHash previews. It is not mentioned on docs.solidjs.com (package README only). This port does not use it, or Unpic; it uses a custom imageSrcset helper plus the per-host Nitro image config and cover preload components. The Vercel half of that Nitro config looks like this:

nitro({
  vercel: {
    config: {
      version: 3,
      images: {
        sizes: IMAGE_WIDTHS,
        formats: ["image/avif", "image/webp"],
      },
    },
  },
}),

From this repo's solid-books/vite.config.ts (optimized branch; domains, remotePatterns, minimumCacheTTL and the Netlify block omitted).

Art direction with <picture>

1st-party

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

SolidImage from the Solid team's @solidjs/image renders a <picture> with one <source> per output format (default webp + jpeg, AVIF available) and a merged srcset; that is modern formats and sizes, not breakpoint art direction. The package is documented in its README only, not on docs.solidjs.com. This port does not use it and builds srcset with its own imageSrcset helper.

Example

@solidjs/image covers formats but not breakpoints, so write the <picture> in the port's cover component. Wide screens get Goodreads' large cover, and narrow screens keep the medium one.

// src/features/book/components/book-cover.tsx
import { getLargeBookImageUrl } from "@/features/book/book-constants";
import { imageSrcset } from "@/lib/image-cdn";
// …
{(src) => (
  <picture>
    <source
      media="(min-width: 768px)"
      srcset={imageSrcset(getLargeBookImageUrl(src())) ?? getLargeBookImageUrl(src())}
      sizes={props.sizes}
    />
    <img
      alt={props.title}
      class="absolute inset-0 h-full w-full object-cover"
      decoding="async"
      width={COVER_WIDTH}
      height={COVER_HEIGHT}
      sizes={props.sizes}
      srcset={imageSrcset(src())}
      src={src()}
    />
  </picture>
)}

Use Unpic (@unpic/react) URL transforms plus IPX/Nitro or the host CDN, chosen in vite.config.ts. No first-party image pipeline is documented (production checklist only says to check large images and dimensions).

import { Image as UnpicImage } from '@unpic/react'
// ...
<UnpicImage {...props} cdn={imageCdn} options={options} />

From this repo's tanstack-books/src/components/ui/image.tsx (optimized branch; options handling simplified).

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

Nothing to enable: no first-party <picture> component is documented (production checklist). Third-party @unpic/react exports a <Source> component (media, type) for use inside a hand-written <picture>; this port does not use it, and because the <picture> is still hand-written the cell stays 🔧, as for Next's getImageProps().

Example

Wrap the port's Unpic <Image> in a hand-written <picture>, and add <Source> from @unpic/react for each art-directed variant. Pass <Source> the same CDN settings the port's Image wrapper uses.

// src/features/book/components/book-cover.tsx
import { Source } from '@unpic/react'
import { Image } from '@/components/ui/image'
import { imageCdn } from '@/lib/image-config'
// …
const small = src ?? EMPTY_IMAGE_URL
const size = { layout: 'constrained', width: COVER_IMAGE_WIDTH, height: COVER_IMAGE_HEIGHT } as const

return (
  <picture>
    <Source
      {...size}
      media="(min-width: 768px)"
      src={getLargeBookImageUrl(small)}
      cdn={imageCdn}
      options={imageCdn === 'ipx' ? { ipx: { baseURL: '/_ipx' } } : undefined}
    />
    <Image {...size} alt={title} src={small} sizes={sizes} priority={priority}
           className="absolute inset-0 size-full object-cover" objectFit="cover" unstyled />
  </picture>
)

Unpic (@unpic/solid) with the same IPX/Nitro or host-CDN setup; no first-party image pipeline is documented (same checklist).

import { Image as UnpicImage } from "@unpic/solid";

From this repo's tanstack-solid-books/src/components/ui/image.tsx (optimized branch).

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

Same as React (checklist), with @unpic/solid.

Example

Write the same <picture> as the React port, with Source from @unpic/solid around the port's <Image> wrapper. Solid uses class instead of className.

// src/features/book/components/book-cover.tsx
import { Source } from "@unpic/solid";
import { Image } from "@/components/ui/image";
import { imageCdn } from "@/lib/image-config";
// …
const small = () => props.src ?? EMPTY_IMAGE_URL;
const size = { layout: "constrained", width: COVER_IMAGE_WIDTH, height: COVER_IMAGE_HEIGHT } as const;

return (
  <picture>
    <Source
      {...size}
      media="(min-width: 768px)"
      src={getLargeBookImageUrl(small())}
      cdn={imageCdn}
      options={imageCdn === "ipx" ? { ipx: { baseURL: "/_ipx" } } : undefined}
    />
    <Image {...size} alt={props.title} src={small()} sizes={props.sizes} priority={props.priority}
           class="absolute inset-0 size-full object-cover" objectFit="cover" unstyled />
  </picture>
);

Pracht

1st-party2 ptsOverview

@pracht/image ships loaders inside the package (vercelLoader, netlifyLoader, cloudflareLoader, defaultLoader, passthroughLoader; createImageHandler from @pracht/image/node), plus placeholder="blur", priority, and build-time ?pracht imports. netlifyLoader was added in @pracht/image 0.5.0; this port uses it on Netlify (@pracht/image 0.6.1).

plugins: [prachtImage(), pracht({ adapter, inlineCss: true })],
import { Image } from '@pracht/image';
// ...
<Image
  alt={title}
  blurDataURL={placeholder}
  fill
  placeholder={placeholder ? 'blur' : 'empty'}
  priority={priority}
  sizes={sizes}
  src={resolved}
/>

From this repo's pracht-books/vite.config.ts and src/features/book/components/book-cover.tsx (optimized branch; some props omitted).

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

@pracht/image emits srcset/sizes; getImageProps() likewise returns plain img attributes, with no <picture> component. Hand-write the <picture> from those attributes, as in the Next snippet above. No Pracht-specific code example was found in the docs.

Example

Call getImageProps() from @pracht/image once per art-directed source, then write the <picture> yourself. The loader configured in the port's src/lib/images.ts still builds every srcset URL.

// src/features/book/components/book-cover.tsx
import { getImageProps } from '@pracht/image';
import { EMPTY_IMAGE_URL, getLargeBookImageUrl } from '@/features/book/book-constants';
import '@/lib/images';
// …
const small = src ?? EMPTY_IMAGE_URL;
const common = { alt: title, fill: true, priority, sizes };
const { srcset: desktop } = getImageProps({ ...common, src: getLargeBookImageUrl(small) });
const mobile = getImageProps({ ...common, src: small });

return (
  <picture>
    <source media="(min-width: 768px)" srcset={desktop} sizes={sizes} />
    <img {...mobile} className="size-full object-cover" onError={() => setFailedSrc(small)} />
  </picture>
);

Waku

Third-party1 ptOverview

No first-party pipeline is documented: the migration guide says use <img> or an image CDN, with no built-in resizing or format negotiation (static assets). This port rewrites Goodreads' m size token to l but emits no srcset.

Code example

There is no image component, so the port renders a plain <img> and rewrites the Goodreads URL itself. The regex swaps the medium-size token m for the large l. There is no resizing, srcset or format negotiation.

// src/features/book/book-constants.ts
export function getLargeBookImageUrl(url: string): string {
  return url.replace(/^(https:\/\/images\.gr-assets\.com\/books\/\d+)m(\/\d+\.jpg)$/, '$1l$2');
}

// src/features/book/components/book-cover.tsx
const resolved = getLargeBookImageUrl(src ?? EMPTY_IMAGE_URL);
// …
<img
  alt={title}
  decoding="async"
  fetchPriority={priority ? 'high' : 'auto'}
  sizes={sizes}
  src={resolved}
/>

Source: Waku: Static assets

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

No first-party support is documented (migration guide); use a plain <img>; any <picture> would be hand-written.

Example

There is no image component, so write the <picture> in the port's cover component. Wide screens get Goodreads' large cover, and narrow screens keep the medium one. React spells the attribute srcSet.

// src/features/book/components/book-cover.tsx
'use client';
// …
const small = src ?? EMPTY_IMAGE_URL;
const large = getLargeBookImageUrl(small);

return (
  <picture>
    <source media="(min-width: 768px)" srcSet={large} />
    <img
      alt={title}
      className="absolute inset-0 size-full object-cover"
      decoding="async"
      fetchPriority={priority ? 'high' : 'auto'}
      onError={() => setFailedSrc(small)}
      src={small}
    />
  </picture>
);

Ember

Third-party1 ptOverview

No first-party image support is documented (the Vite guide covers build setup only). The community @responsive-image/ember addon with @responsive-image/vite-plugin covers build-time resizing, srcset, and AVIF/WebP for Embroider + Vite apps; this port does not use it and renders a plain <img> with no srcset or sizes.

Code example

Add the @responsive-image/vite-plugin to the Embroider Vite config. An import ending in ?responsive is resized at build time, and the <ResponsiveImage> component from @responsive-image/ember renders the srcset.

// vite.config.mjs
import { defineConfig } from 'vite';
import { extensions, ember } from '@embroider/vite';
import { babel } from '@rollup/plugin-babel';
import { responsiveImage } from '@responsive-image/vite-plugin';

export default defineConfig({
  plugins: [ember(), babel({ babelHelpers: 'runtime', extensions }), responsiveImage()],
});
// app/components/home/hero.gjs
import { ResponsiveImage } from '@responsive-image/ember';
import heroImage from './hero.jpg?w=640;1280;1920&responsive';

<template>
  <ResponsiveImage @src={{heroImage}} @size={{100}} alt="Shelves of books" />
</template>

Source: responsive-image: Image component

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

The Vite guide covers build setup only; no first-party support is documented; use a plain <img>.

Example

Replace the <img> in the port's cover component with a hand-written <picture>. Wide screens get Goodreads' large cover, and narrow screens keep the medium one.

// app/components/book/book-cover.gjs
import { EMPTY_IMAGE_URL, getLargeBookImageUrl } from '../../lib/book/book-constants';
// …
  get small() {
    return this.args.src ?? EMPTY_IMAGE_URL;
  }

  get large() {
    return getLargeBookImageUrl(this.small);
  }

  <template>
    <picture>
      <source media="(min-width: 768px)" srcset={{this.large}} />
      <img
        alt={{@title}}
        class="absolute inset-0 size-full object-cover"
        decoding="async"
        loading={{this.loading}}
        src={{this.small}}
        {{on "error" this.onError}}
      />
    </picture>
  </template>

Astro

1st-party2 ptsOverview

<Image /> from astro:assets optimizes local and authorized remote images; Sharp is the default service; responsive layout/srcset since astro@5.10.0; public/ images are not optimized. Cloudflare, Vercel, and Netlify adapters have host image services. (images, cloudflare, vercel, netlify)

Code example

<Image /> from astro:assets resizes and converts imported local images at build time. layout="constrained" adds a responsive srcset, and image.domains lets remote images through the same pipeline.

---
// src/components/Cover.astro
import { Image } from 'astro:assets';
import cover from '../assets/cover.jpg';
---
<Image src={cover} alt="Book cover" layout="constrained" width={800} height={600} />
// astro.config.mjs
import { defineConfig } from 'astro/config';

export default defineConfig({
  image: {
    domains: ['covers.example.com'],
  },
});

Source: Astro: Images

Art direction with <picture>

1st-party

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

<Picture /> (astro@3.3.0+) emits <picture> with formats (default webp) plus a fallback <img>. Breakpoint art direction is not in the component docs; the official recipe uses getImage() and a hand-written <picture>/<source media>. (astro-assets, build-custom-img-component)

Example

<Picture /> handles formats, not breakpoints. Astro's recipe calls getImage() once per crop and writes the <picture> by hand.

---
// src/components/Hero.astro
import { getImage } from "astro:assets";
import wide from "../assets/hero-wide.jpg";
import square from "../assets/hero-square.jpg";

const desktop = await getImage({ src: wide, width: 1600, format: "avif" });
const mobile = await getImage({ src: square, width: 600, format: "webp" });
const fallback = await getImage({ src: square, width: 600 });
---
<picture>
  <source media="(min-width: 768px)" srcset={desktop.src} type="image/avif" />
  <source srcset={mobile.src} type="image/webp" />
  <img src={fallback.src} {...fallback.attributes} alt="Shelves of books" />
</picture>

Source: Astro: build a custom image component

React Router

Third-party1 ptOverview

No first-party image component or optimizer documented (only a ?url asset import is shown); use a community package such as @unpic/react or a host image CDN by hand. (styling)

Code example

Install @unpic/react and render its <Image> in place of <img>. When it recognizes the image CDN in the URL, it writes a responsive srcset that asks the CDN for each width. It also sets sizes, dimensions and lazy loading.

// app/features/book/components/book-cover.tsx
import { Image } from '@unpic/react'

export function BookCover({ src, title }: { src: string; title: string }) {
  return (
    <Image
      src={src}
      layout="constrained"
      width={300}
      height={450}
      alt={title}
    />
  )
}

Source: Unpic: @unpic/react

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

No first-party <picture> helper documented; hand-write the markup. (styling)

Example

There is no image component, so write <picture> in a route or component, with files served from public/. React spells the attribute srcSet.

// app/features/home/hero-image.tsx
export function HeroImage() {
  return (
    <picture>
      {/* art direction: a square crop on narrow screens */}
      <source media="(max-width: 640px)" type="image/avif"
              srcSet="/media/hero-square-640.avif" width={640} height={640} />
      {/* format fallback: AVIF, then WebP, then the <img> JPEG */}
      <source type="image/avif" sizes="100vw"
              srcSet="/media/hero-1280.avif 1280w, /media/hero-1920.avif 1920w" />
      <source type="image/webp" sizes="100vw"
              srcSet="/media/hero-1280.webp 1280w, /media/hero-1920.webp 1920w" />
      <img src="/media/hero-1280.jpg" alt="Shelves of books" width={1280} height={720}
           fetchPriority="high" decoding="async" />
    </picture>
  )
}

Source: MDN: the picture element

Qwik City

1st-party2 ptsOverview

built-in ?jsx import suffix (the qwikCity() Vite plugin bundles vite-imagetools; the docs call it "a built-in feature ... no additional packages or components need to be installed"): <img> with srcset (200-1200w webp), loading=lazy, decoding=async, width/height. Local src images only per docs; @unpic/qwik is third-party (per the docs) and qwik-image is a separate CDN-loader component whose repo now sits in the QwikDev org. (image-optimization)

Code example

Add ?jsx to a local image import to get a component. It renders an <img> with a webp srcset (200w to 1200w), loading="lazy", decoding="async", and width/height.

// src/components/hero/hero.tsx
import { component$ } from '@builder.io/qwik'
import HeroImage from '~/media/hero.jpg?quality=80&jsx'

export const Hero = component$(() => (
  <HeroImage alt="Shelves of books" loading="eager" decoding="sync" />
))

Source: Qwik: Image optimization

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

?jsx emits <img>/srcset as webp (format overridable); the docs mention no <picture> or sizes, so no first-party <picture> documented. (image-optimization)

Example

The ?jsx image import only emits an <img>, so write <picture> in JSX yourself, with files served from public/. Qwik uses HTML attribute names such as srcset.

// src/components/hero-image/hero-image.tsx
import { component$ } from '@builder.io/qwik'

export const HeroImage = component$(() => (
  <picture>
    {/* art direction: a square crop on narrow screens */}
    <source media="(max-width: 640px)" type="image/avif"
            srcset="/media/hero-square-640.avif" width={640} height={640} />
    {/* format fallback: AVIF, then WebP, then the <img> JPEG */}
    <source type="image/avif" sizes="100vw"
            srcset="/media/hero-1280.avif 1280w, /media/hero-1920.avif 1920w" />
    <source type="image/webp" sizes="100vw"
            srcset="/media/hero-1280.webp 1280w, /media/hero-1920.webp 1920w" />
    <img src="/media/hero-1280.jpg" alt="Shelves of books" width={1280} height={720}
         fetchPriority="high" decoding="async" />
  </picture>
))

Source: MDN: the picture element

Angular (SSR)

1st-party2 ptsOverview

NgOptimizedImage: priority (fetchpriority=high, eager, SSR preload link), auto srcset, placeholder blur, lazy by default. Built-in loaders for Cloudflare Image Resizing, Cloudinary, ImageKit, Imgix, Netlify; it does not resize itself (the default loader is a no-op). (image-optimization)

Code example

NgOptimizedImage with a built-in loader. The loader builds CDN URLs for each ngSrcset width; priority marks the LCP image and placeholder shows a low-res blur from the same CDN.

// src/app/app.config.ts
import { provideImgixLoader } from '@angular/common';

export const appConfig: ApplicationConfig = {
  providers: [provideImgixLoader('https://books.imgix.net/')],
};

// src/app/book/book-cover.ts
import { NgOptimizedImage } from '@angular/common';

@Component({
  selector: 'app-book-cover',
  imports: [NgOptimizedImage],
  template: `
    <img [ngSrc]="src()" width="400" height="600" [alt]="title()"
         ngSrcset="200w, 400w, 800w" sizes="(max-width: 640px) 50vw, 200px"
         [priority]="priority()" placeholder />
  `,
})
export class BookCover { /* … */ }

Source: Angular: Getting started with NgOptimizedImage

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

The NgOptimizedImage page says <picture> is not supported yet ("on our roadmap"); no art direction or <source type> format fallback is documented. Format is left to the configured image-CDN loader (the page says only that the loader sets "size, format, and image quality transformations"). No first-party <picture> documented; hand-write it. (image-optimization)

Example

NgOptimizedImage can't render <picture>, so write the element in a component template with plain <source> tags for format fallback and art direction.

// src/app/home/hero-image.ts
import { ChangeDetectionStrategy, Component } from '@angular/core';

@Component({
  selector: 'app-hero-image',
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: `
    <picture>
      <!-- art direction: a square crop on narrow screens -->
      <source media="(max-width: 640px)" type="image/avif"
              srcset="/media/hero-square-640.avif" width="640" height="640" />
      <!-- format fallback: AVIF, then WebP, then the <img> JPEG -->
      <source type="image/avif" sizes="100vw"
              srcset="/media/hero-1280.avif 1280w, /media/hero-1920.avif 1920w" />
      <source type="image/webp" sizes="100vw"
              srcset="/media/hero-1280.webp 1280w, /media/hero-1920.webp 1920w" />
      <img src="/media/hero-1280.jpg" alt="Shelves of books" width="1280" height="720"
           fetchpriority="high" decoding="async" />
    </picture>
  `,
})
export class HeroImage {}

Source: Angular image optimization FAQ

Marko

Third-party1 ptOverview

No image component or optimizer documented; the native-tag page and the full reference contain only an og:image meta example and plain <img>. @marko/vite rewrites static relative <img src> paths to hashed Vite assets but does not resize or convert. A host image CDN wired by hand is the third-party route, as for React Router and Ember. (native-tag)

Code example

Marko has no image component, so a small tag builds a srcset against the host's image CDN. This one uses Netlify Image CDN URLs; remote sources must be allowlisted in netlify.toml.

// src/tags/book-cover.marko
export interface Input { src: string; title: string; sizes: string; priority?: boolean }

static const WIDTHS = [160, 320, 640];
static function cdn(src: string, w: number) {
  return `/.netlify/images?url=${encodeURIComponent(src)}&w=${w}&q=75`;
}

<img
  src=cdn(input.src, 320)
  srcset=WIDTHS.map((w) => `${cdn(input.src, w)} ${w}w`).join(", ")
  sizes=input.sizes
  alt=input.title
  width=320 height=480
  loading=(input.priority ? "eager" : "lazy")
  fetchpriority=(input.priority ? "high" : undefined)
/>
# netlify.toml
[images]
  remote_images = ['https://images\.gr-assets\.com/.*']

Source: Netlify: Image CDN overview

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

All native HTML tags are supported, so <picture> is hand-written. No first-party image helper documented on the native-tag page or in the full reference. (native-tag)

Example

Marko renders native tags as-is, so you write <picture> in a custom tag. You also produce each format and crop yourself and put them in public/.

// src/tags/hero-image.marko
export interface Input {
  alt: string;
  priority?: boolean;
}

<picture>
  <source media="(min-width: 1000px)" type="image/avif" srcset="/hero-wide.avif">
  <source media="(min-width: 1000px)" srcset="/hero-wide.jpg">
  <source type="image/avif" srcset="/hero-tall.avif">
  <img
    src="/hero-tall.jpg"
    alt=input.alt
    width=750
    height=1334
    decoding="async"
    fetchpriority=(input.priority ? "high" : undefined)
    loading=(input.priority ? "eager" : "lazy")
  >
</picture>

Source: Marko native tags

Fresh

Third-party1 ptOverview

The docs say there is no built-in optimization pipeline and suggest vite-imagetools or a CDN. Fresh adds long-lived cache headers to src/srcset (opt out with data-fresh-disable-lock); asset() / assetSrcSet() exist in fresh/runtime. (static-files, api-reference)

Code example

Fresh 2 builds with Vite, so vite-imagetools resizes and converts images at build time. The query string on the import picks widths and format, and as=srcset returns a ready srcset string.

// vite.config.ts
import { defineConfig } from "vite";
import { fresh } from "@fresh/plugin-vite";
import { imagetools } from "vite-imagetools";

export default defineConfig({
  plugins: [fresh(), imagetools()],
});
// routes/about.tsx
import heroAvif from "../static/hero.jpg?format=avif&w=800";
import heroSrcset from "../static/hero.jpg?w=400;800;1200&format=webp&as=srcset";

export default function About() {
  return <img src={heroAvif} srcset={heroSrcset} sizes="100vw" alt="Shelves of books" width={800} />;
}

Source: Fresh: Static files

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

No first-party <picture> component documented; the docs point to vite-imagetools or a CDN, with markup hand-written. (static-files)

Example

You write the <picture> markup in a Preact component and put each pre-encoded format and crop in static/ yourself.

// components/Hero.tsx
export function Hero() {
  return (
    <picture>
      <source media="(min-width: 1000px)" type="image/avif" srcset="/hero-wide.avif" />
      <source media="(min-width: 1000px)" srcset="/hero-wide.jpg" />
      <source type="image/avif" srcset="/hero-tall.avif" />
      <img
        src="/hero-tall.jpg"
        alt="Shelves of books"
        width={750}
        height={1334}
        fetchPriority="high"
        decoding="async"
      />
    </picture>
  );
}

Source: Fresh static files

Analog

1st-party2 ptsOverview

Angular's NgOptimizedImage from @angular/common, a required dependency of every Analog app: ngSrc, priority, automatic srcset, lazy loading, and loaders for Cloudflare, Cloudinary, ImageKit, Imgix and Netlify. It is an Angular-team package, and the Analog docs do not cover images. (image-optimization)

Code example

Import NgOptimizedImage from @angular/common and use ngSrc. Width and height are required, priority marks the LCP image, and a loader provider builds CDN URLs.

// src/app/pages/index.page.ts
import { Component } from '@angular/core';
import { NgOptimizedImage } from '@angular/common';

@Component({
  imports: [NgOptimizedImage],
  template: `
    <img ngSrc="covers/dune.jpg" width="400" height="600" priority />
    <img ngSrc="covers/emma.jpg" ngSrcset="200w, 400w" sizes="50vw" width="400" height="600" />
  `,
})
export default class HomePage {}

// src/app/app.config.ts
// providers: [provideImgixLoader('https://books.imgix.net/'), /* … */]

Source: Angular: Image optimization

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

The NgOptimizedImage page says <picture> is not supported yet; hand-write the markup. (image-optimization)

Example

NgOptimizedImage can't render <picture>, so write the element in a page template with plain <source> tags. Files in public/ are served from the site root.

// src/app/pages/index.page.ts
import { Component } from '@angular/core';

@Component({
  selector: 'app-home',
  template: `
    <picture>
      <!-- art direction: a square crop on narrow screens -->
      <source media="(max-width: 640px)" type="image/avif"
              srcset="/media/hero-square-640.avif" width="640" height="640" />
      <source type="image/avif" sizes="100vw"
              srcset="/media/hero-1280.avif 1280w, /media/hero-1920.avif 1920w" />
      <img src="/media/hero-1280.jpg" alt="Shelves of books" width="1280" height="720"
           fetchpriority="high" decoding="async" />
    </picture>
  `,
})
export default class HomePage {}

Source: Angular image optimization FAQ

Vike

Third-party1 ptOverview

No image component or optimizer documented; the +image setting only sets the og:image preview. Use a community package such as @unpic/react or a host image CDN. (image, static-directory)

Code example

Use <Image> from @unpic/react. It builds a srcset for the image CDN that serves the URL and sets width, height and lazy loading.

// pages/book/@id/+Page.tsx
import { Image } from '@unpic/react'
import { useData } from 'vike-react/useData'

export function Page() {
  const book = useData<{ title: string; coverUrl: string }>()
  return (
    <Image src={book.coverUrl} layout="constrained" width={400} height={600} alt={book.title} priority />
  )
}

Source: Unpic: React

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

No first-party <picture> helper documented; hand-write the markup. (image)

Example

Vike has no image component, so write <picture> in the page. With @unpic/react, each <Source> gets a media query and its own crop, and <Image> is the fallback.

// pages/book/@id/BookCover.tsx
import { Image, Source } from '@unpic/react'

export function BookCover({ title, coverUrl, wideUrl }: { title: string; coverUrl: string; wideUrl: string }) {
  return (
    <picture>
      {/* art direction: a wide banner crop on large screens */}
      <Source media="(min-width: 768px)" src={wideUrl} layout="constrained" width={1200} height={400} />
      <Image src={coverUrl} alt={title} layout="constrained" width={400} height={600} priority />
    </picture>
  )
}

Source: Unpic: React · MDN: the picture element

RedwoodSDK

Third-party1 ptOverview

No image component or optimizer documented; images are plain <img> tags served from public/. The third-party route is the host's Cloudflare Images transformations, wired by hand. (public-assets)

Code example

Turn on Cloudflare Images transformations for the zone, then build /cdn-cgi/image/<OPTIONS>/<SOURCE> URLs by hand. This helper writes a srcSet that asks Cloudflare for each width in the best format the browser accepts.

// src/app/components/CfImage.tsx
const cf = (src: string, width: number) =>
  `/cdn-cgi/image/width=${width},quality=75,format=auto${src}`;

export function CfImage({ src, alt, width, height }: {
  src: string; alt: string; width: number; height: number;
}) {
  return (
    <img
      src={cf(src, width)}
      srcSet={[1, 2].map((d) => `${cf(src, width * d)} ${width * d}w`).join(", ")}
      sizes={`${width}px`}
      alt={alt} width={width} height={height} loading="lazy" decoding="async"
    />
  );
}

Source: Cloudflare Images: Transform via URL

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

No first-party <picture> helper documented; hand-write the markup. (public-assets)

Example

There is no image component, so write the <picture> by hand in a server component. Wide screens get a landscape crop and narrow screens get a square one, both served from public/. React spells the attribute srcSet.

// src/app/components/Hero.tsx
export function Hero() {
  return (
    <picture>
      {/* art direction: a square crop on narrow screens */}
      <source media="(max-width: 640px)" srcSet="/images/hero-square-640.webp"
              width={640} height={640} />
      <source media="(min-width: 641px)" srcSet="/images/hero-wide-1600.webp"
              width={1600} height={900} />
      <img src="/images/hero-wide-1600.jpg" alt="Shelves of books"
           width={1600} height={900} fetchPriority="high" decoding="async" />
    </picture>
  );
}

Source: MDN: the picture element · RedwoodSDK: Public Assets

Remix 3

Third-party1 ptOverview

The asset server has a first-party transform pipeline: files.transforms defined with defineFileTransform, requested as assets.getHref(path, { transform: [["resize", "400"], "webp"] }), with createFsFileCache() for results. The resize and format code is written by the app with the third-party Sharp library, and there is no image component or srcset helper. (files-and-assets, assets)

Code example

The asset server runs named file transforms that the app writes with Sharp. A URL picks the chain, and createFsFileCache() keeps the results on disk.

// app/assets.ts  (npm i sharp)
import { createAssetServer, createFsFileCache, defineFileTransform } from "remix/assets";
import sharp from "sharp";

export const assets = createAssetServer({
  // …
  files: {
    extensions: [".png", ".jpg"],
    transforms: {
      resize: defineFileTransform({
        extensions: [".png", ".jpg"],
        param: true,
        // check that param is a width in range before using it
        transform: (bytes, { param }) => sharp(bytes).resize({ width: Number(param) }).toBuffer(),
      }),
      webp: defineFileTransform({
        extensions: [".png", ".jpg"],
        transform: async (bytes) => ({ content: await sharp(bytes).webp().toBuffer(), extension: ".webp" }),
      }),
    },
    cache: createFsFileCache(),
  },
});

// in an action
let coverHref = await assets.getHref("app/ui/public/cover.jpg", { transform: [["resize", "400"], "webp"] });

Source: Remix: Files and assets, transform images and other files

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

No first-party <picture> helper documented; hand-write <picture> with transform URLs from assets.getHref(). (files-and-assets)

Example

There is no image component, so write <picture> yourself. Resolve each crop and format with assets.getHref() transforms in the action and pass the URLs in as props.

// app/ui/hero-image.tsx
import type { Handle } from "remix/component";
import { assets } from "../assets.ts";

export async function getHeroSources() {
  let get = (file: string, transform: (string | [string, string])[]) => assets.getHref(`app/ui/public/${file}`, { transform });
  return {
    square: await get("hero-square.jpg", [["resize", "640"], "webp"]),
    wide: await get("hero-wide.jpg", [["resize", "1280"], "webp"]),
    fallback: await get("hero-wide.jpg", [["resize", "1280"]]),
  };
}

export function HeroImage(handle: Handle<Awaited<ReturnType<typeof getHeroSources>>>) {
  return () => (
    <picture>
      {/* art direction: a square crop on narrow screens */}
      <source media="(max-width: 640px)" type="image/webp" srcset={handle.props.square} />
      <source type="image/webp" srcset={handle.props.wide} />
      <img src={handle.props.fallback} alt="Shelves of books" width={1280} height={720}
           fetchpriority="high" decoding="async" />
    </picture>
  );
}

Source: Remix: Files and assets, transform images and other files

Void (React)

Third-party1 ptOverview

No image component or optimizer documented; the head guide covers only og:image URLs, and Markdown images are lazy-loaded. Use a community package such as Unpic or a host image CDN. (head, markdown)

Code example

Void has no image component. Resize and re-encode at build time with vite-imagetools query imports, and write width, height and loading yourself. For remote covers, use @unpic/react with an image CDN.

// components/Cover.tsx
import srcset from './cover.jpg?w=320;640;960&format=webp&as=srcset'
import fallback from './cover.jpg?w=640&format=webp'

export function Cover({ title }: { title: string }) {
  return (
    <img src={fallback} srcSet={srcset} sizes="320px" width={320} height={480} loading="lazy" decoding="async" alt={title} />
  )
}

Source: vite-imagetools · Unpic

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

No first-party <picture> helper documented; hand-write the markup. (head)

Example

Write the <picture> by hand. The ?as=srcset imports give each <source> its own format or crop, and the <img> is the fallback.

// components/Cover.tsx
import avif from './cover.jpg?w=320;640;960&format=avif&as=srcset'
import webp from './cover.jpg?w=320;640;960&format=webp&as=srcset'
import fallback from './cover.jpg?w=640&format=webp'

export function Cover({ title }: { title: string }) {
  return (
    <picture>
      <source type="image/avif" srcSet={avif} sizes="320px" />
      <img src={fallback} srcSet={webp} sizes="320px" width={320} height={480} alt={title} />
    </picture>
  )
}

Source: vite-imagetools: as=srcset · MDN: <picture>

Void (Vue)

Third-party1 ptOverview

No image component or optimizer documented; the head guide covers only og:image URLs, and Markdown images are lazy-loaded. Use a community package such as Unpic or a host image CDN. (head, markdown)

Code example

Void has no image component. Resize and re-encode at build time with vite-imagetools query imports, and write width, height and loading yourself. For remote covers, use @unpic/vue with an image CDN.

<!-- components/Cover.vue -->
<script setup lang="ts">
import srcset from './cover.jpg?w=320;640;960&format=webp&as=srcset'
import fallback from './cover.jpg?w=640&format=webp'
defineProps<{ title: string }>()
</script>

<template>
  <img :src="fallback" :srcset="srcset" sizes="320px" width="320" height="480" loading="lazy" decoding="async" :alt="title" />
</template>

Source: vite-imagetools · Unpic

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

No first-party <picture> helper documented; hand-write the markup. (head)

Example

Write the <picture> by hand. The ?as=srcset imports give each <source> its own format or crop, and the <img> is the fallback.

<!-- components/Cover.vue -->
<script setup lang="ts">
import avif from './cover.jpg?w=320;640;960&format=avif&as=srcset'
import webp from './cover.jpg?w=320;640;960&format=webp&as=srcset'
import fallback from './cover.jpg?w=640&format=webp'
defineProps<{ title: string }>()
</script>

<template>
  <picture>
    <source type="image/avif" :srcset="avif" sizes="320px" />
    <img :src="fallback" :srcset="webp" sizes="320px" width="320" height="480" :alt="title" />
  </picture>
</template>

Source: vite-imagetools: as=srcset · MDN: <picture>

Void (Svelte)

Third-party1 ptOverview

No image component or optimizer documented; the head guide covers only og:image URLs, and Markdown images are lazy-loaded. Use a community package such as Unpic or a host image CDN. (head, markdown)

Code example

Void has no image component. For remote covers, use @unpic/svelte with an image CDN; for local files, resize and re-encode at build time with vite-imagetools query imports. Either way write width, height and loading yourself.

<!-- components/Cover.svelte -->
<script lang="ts">
  import { Image } from '@unpic/svelte'
  let { src, title } = $props()
</script>

<Image {src} cdn="ipx" layout="fixed" width={320} height={480} loading="lazy" alt={title} />

Source: Unpic · vite-imagetools

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

No first-party <picture> helper documented; hand-write the markup. (head)

Example

Write the <picture> by hand. The ?as=srcset imports give each <source> its own format or crop, and the <img> is the fallback.

<!-- components/Cover.svelte -->
<script lang="ts">
  import avif from './cover.jpg?w=320;640;960&format=avif&as=srcset'
  import webp from './cover.jpg?w=320;640;960&format=webp&as=srcset'
  import fallback from './cover.jpg?w=640&format=webp'
  let { title } = $props()
</script>

<picture>
  <source type="image/avif" srcset={avif} sizes="320px" />
  <img src={fallback} srcset={webp} sizes="320px" width="320" height="480" alt={title} />
</picture>

Source: vite-imagetools: as=srcset · MDN: <picture>

Void (Solid)

Third-party1 ptOverview

No image component or optimizer documented; the head guide covers only og:image URLs, and Markdown images are lazy-loaded. Use a community package such as Unpic or a host image CDN. (head, markdown)

Code example

Void has no image component. Resize and re-encode at build time with vite-imagetools query imports, and write width, height and loading yourself. For remote covers, use @unpic/solid with an image CDN.

// components/Cover.tsx
import srcset from './cover.jpg?w=320;640;960&format=webp&as=srcset'
import fallback from './cover.jpg?w=640&format=webp'

export function Cover(props: { title: string }) {
  return (
    <img src={fallback} srcset={srcset} sizes="320px" width={320} height={480} loading="lazy" decoding="async" alt={props.title} />
  )
}

Source: vite-imagetools · Unpic

Art direction with <picture>

Manual

Serving a different crop or format per screen size. Not scored: the label shows how much the framework does for you.

No first-party <picture> helper documented; hand-write the markup. (head)

Example

Write the <picture> by hand. The ?as=srcset imports give each <source> its own format or crop, and the <img> is the fallback.

// components/Cover.tsx
import avif from './cover.jpg?w=320;640;960&format=avif&as=srcset'
import webp from './cover.jpg?w=320;640;960&format=webp&as=srcset'
import fallback from './cover.jpg?w=640&format=webp'

export function Cover(props: { title: string }) {
  return (
    <picture>
      <source type="image/avif" srcset={avif} sizes="320px" />
      <img src={fallback} srcset={webp} sizes="320px" width={320} height={480} alt={props.title} />
    </picture>
  )
}

Source: vite-imagetools: as=srcset · MDN: <picture>

Gotchas

  • Unpic only builds URLs; something (IPX, a host CDN) still has to serve the resized image.