Prompt

How do I generate multiple image sizes automatically for a website?

Technology / CDN & Edge Infrastructure1 observationLast seen Nov 3, 2026

Latest observation

Nov 3, 2026OpenAI APIWeb search: off

A good way to generate multiple image sizes automatically is to use responsive images plus a build step or image service that creates the variants for you.

Best approach

1) Create multiple resized versions

Generate several widths of each image, for example:

  • 320px
  • 640px
  • 960px
  • 1280px

This lets the browser download the best size for the device.

2) Serve them with srcset

Example:

<img
  src="image-640.jpg"
  srcset="
    image-320.jpg 320w,
    image-640.jpg 640w,
    image-960.jpg 960w,
    image-1280.jpg 1280w
  "
  sizes="(max-width: 600px) 100vw, 600px"
  alt="Example image"
/>
  • srcset tells the browser which versions exist.
  • sizes tells the browser how wide the image will be on the page.

Ways to generate the images automatically

Option A: Use a build tool

If you have a website build process, use tools like:

  • Sharp (Node.js)
  • ImageMagick
  • gulp-responsive
  • Webpack/Vite plugins

Example with Sharp in Node.js:

import sharp from "sharp";

const sizes = [320, 640, 960, 1280];

for (const width of sizes) {
  await sharp("input.jpg")
    .resize({ width })
    .jpeg({ quality: 80 })
    .toFile(`output/image-${width}.jpg`);
}

Option B: Use an image CDN/service

Services like:

  • Cloudinary
  • Imgix
  • ImageKit
  • Netlify Large Media / built-in image transforms depending on platform

These can resize on the fly and often generate modern formats like WebP or AVIF automatically.

Option C: Use static site generators/frameworks

Frameworks often have built-in image optimization:

  • Next.js: next/image
  • Astro image integrations
  • Gatsby image plugins
  • Eleventy with plugins

Recommended extras

  • Generate WebP and/or AVIF too
  • Use lazy loading:
    <img loading="lazy" ... />
    
  • Compress images to reduce file size
  • Keep aspect ratios consistent

If you want the simplest setup

For a typical site:

  1. Use Sharp in a build script to make 4–5 widths
  2. Output JPG + WebP
  3. Use srcset in HTML

If you want, I can give you:

  • a Node.js script that auto-generates responsive images, or
  • an example for Next.js / WordPress / Python.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.