← notes

Astro + Cloudflare Image Service Integration

May 15, 2026 · astro, cloudflare, images, performance

Quick Setup

Cloudflare provides an IMAGES binding when deploying Astro on Workers. This enables on-the-fly image optimization without separate infrastructure.

// astro.config.mjs
export default defineConfig({
  output: 'server',
  adapter: cloudflare(),
  image: {
    service: {
      entrypoint: '@astrojs/cloudflare/image-service',
    },
  },
});

Usage in Components

---
import { Image } from 'astro:assets';
import src from '@/assets/my-image.jpg';
---

<Image src={src} alt="Description" width={800} height={600} />

Cloudflare automatically handles resizing, format negotiation, and global caching.

Performance Considerations