Skip to content
smallPict
Start free
HomeIntegrationsNext.js Framework

Image optimization for Next.js 14, 15 and 16

Eliminate expensive Vercel image optimization overages. SmallPict serves as a high-performance custom loader for next/image, providing AVIF/WebP streaming, edge caching, and blurhash placeholders.

Install

TYPESCRIPT Package
$ npm install @smallpict/next

Implementation example

typescript
// smallpict-loader.ts
export default function smallPictLoader({ src, width, quality }: { src: string; width: number; quality?: number }) {
  const params = new URLSearchParams({
    url: src,
    w: width.toString(),
    q: (quality || 80).toString(),
    f: 'auto'
  });
  return `https://cdn.smallpict.app/v1/optimize?${params.toString()}`;
}

// next.config.ts
import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
  images: {
    loader: 'custom',
    loaderFile: './smallpict-loader.ts',
  },
};
export default nextConfig;

Integration steps

  1. Create smallpict-loader.ts

    Configure the loader function to point at the SmallPict CDN.

  2. Register in next.config.ts

    Set images.loader = "custom" and images.loaderFile in your Next.js config.

  3. Use standard next/image

    Use Image as normal.

Key benefits

  • Avoid $10/1000 requests Vercel image transform charges
  • Edge-cached images worldwide
  • Automatic responsive srcset generation
  • Full Next.js App Router & Server Components support

Need complete implementation guides & API specs?

Explore parameter references, authentication mechanisms, error codes, and local testing instructions in our official Next.js Framework developer guide.

Read Next.js Framework Docs

Speed Up Your Next.js Framework Image Pipeline

Try AVIF and WebP image optimization in your application. No setup fee, and sandbox keys right away.