flpbalada/fb-skills

nextjs-image-art-direction

Implement Next.js image art direction with getImageProps(), picture, source, and img.

First seen May 4, 2026

Installation

$ npx skills add flpbalada/fb-skills --skill nextjs-image-art-direction

Summary

  • Implement Next.js image art direction with getImageProps(), picture, source, and img.
  • Use when mobile, tablet, or desktop need different image assets, crops, focal points, compositions, or carousel media while keeping Next.js image optimization.
  • Do not use for simple responsive sizing of the same image; use normal next/image sizes for that.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from flpbalada/fb-skills · top by installs.

npx skills add flpbalada/fb-skills

Browse all from flpbalada/fb-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 7
Default branch main
Open issues 0
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,537 B
  • docs SUMMARY.md 376 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 10 installs

SKILL.md

Next.js Image Art Direction

Use art direction when viewport size needs different image content or crop.

Goal

Render one correct image per viewport. Keep Next.js image optimization. Avoid loading unused images.

Rules

  • Use <picture> with <source> and final <img>.
  • Use getImageProps() for each asset.
  • Share alt and sizes.
  • Make alt accurate for all variants.
  • Order sources so first matching media query wins.
  • Do not use preload or loading="eager".
  • Use fetchPriority="high" for LCP image when needed.
  • Do not use placeholder with getImageProps().

Pattern

import { getImageProps } from 'next/image'

export function HeroImage() {
  const common = { alt: 'Mountain landscape', sizes: '100vw' }
  const { props: { srcSet: desktop } } = getImageProps({
    ...common,
    src: '/hero-desktop.jpg',
    width: 1440,
    height: 875,
  })
  const { props: { srcSet: mobile, ...rest } } = getImageProps({
    ...common,
    src: '/hero-mobile.jpg',
    width: 750,
    height: 1334,
  })

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

Flow

  1. Confirm content changes, not only size.
  2. Pick assets per breakpoint.
  3. Define common props.
  4. Generate srcSet per asset.
  5. Put <source> before fallback <img>.
  6. Test desktop, tablet, and mobile.
  7. Confirm only matching image loads.

References

Output

## Art Direction Plan

Use case: [why different images are needed]
Breakpoints:
- [media query]: [asset], [width]x[height]
- fallback: [asset], [width]x[height]

Common props:
- alt: [text]
- sizes: [value]
- priority: [fetchPriority if LCP]