Heads-up
The default Next.js loader fetches and optimizes images through your Next.js host, so that host's image charges can still apply. The unoptimized option serves the source directly but does not generate responsive variants. Public embeds must use public images.
Step by step
1. Allow the image source
This example uses our own editor screenshot on swiftimg.com. Allow that exact path and the delivery paths used by your uploads. Restart Next.js after editing the config.
next.config.mjs // next.config.mjs export default { images: { remotePatterns: [ { protocol: "https", hostname: "swiftimg.com", pathname: "/marketing/basic.png", search: "" }, { protocol: "https", hostname: "i.swiftimg.com", pathname: "/**", search: "" }, ], }, };2. Render a real public image
Save this complete component as app/page.tsx. The example image is 1392 × 745 pixels. After uploading your own image, use the returned directUrl and its actual width and height, not the viewer page URL.
app/page.tsx import Image from "next/image"; export default function Page() { return ( <main> <h1>Our image editor</h1> <Image src="https://swiftimg.com/marketing/basic.png" width={1392} height={745} alt="Swiftimg editor with crop, rotation and export controls" sizes="(max-width: 960px) 100vw, 960px" style={{ width: "100%", maxWidth: 960, height: "auto" }} /> </main> ); }3. Choose who optimizes the image
Keep the default loader for Next.js optimization. For a pre-sized image, animated GIF, or static export without an optimizer, add unoptimized to Image. It then uses the source URL directly. Resize before upload with the free editor if needed. Do not put API keys or signing secrets in a client-side loader; advanced signed transforms must be generated on your server using the documented API.
Direct delivery option <Image unoptimized src="https://swiftimg.com/marketing/basic.png" width={1392} height={745} alt="Swiftimg image editor" />4. Check the result
Open the page and inspect the image request in your browser Network panel. Default optimization uses /_next/image; unoptimized uses the source URL. A 400 response usually needs a remotePatterns check. A 404 needs the exact returned directUrl. A private image requires authorized access and is not a public embed. Verify the layout at narrow and wide screen sizes.
Reference: Next.js Image documentation. Use the free editor for a pre-sized image or the API documentation for server-generated signed transforms.
Next.js — FAQ
Does external hosting remove Next.js optimization charges?
No. With the default loader, Next.js still optimizes the remote source. Using unoptimized bypasses that optimizer but also gives up its generated sizes and formats. Check both hosting plans for their limits.
Can I use output: 'export'?
Use unoptimized for this example when using static export. The default Next.js optimizer needs a server. A supported external loader is another option, but never expose signing secrets in browser code.
Can I mix local and hosted images?
Yes. Use local /public paths or imported files for local assets, and public direct URLs for hosted assets. Set accurate dimensions or an appropriate fill layout.
See also
Image hosting for SvelteKit
Reference swiftimg URLs from SvelteKit components and Markdown content. Permanent URLs, on-the-fly resize, and global delivery.
Image hosting for Vue / Nuxt
Configure @nuxt/image (or your own Vue component) to fetch from swiftimg. Permanent URLs, on-the-fly resize, and global delivery.
Image hosting for Astro
Reference swiftimg URLs from Astro's <Image /> component. Permanent URLs, automatic WebP variants, on-the-fly resize, and global delivery.
swiftimg vs Cloudflare Images
Compare swiftimg and Cloudflare Images: hosting workflows, editing, costs and migration.
Hosting for Next.js works on the free plan — see swiftimg pricing and plan limits for what each tier includes, or read the image hosting API documentation to upload from your own code instead of the browser.
Ready to host your Next.js images?
Browser uploads and API access are available free. Paid plans add higher limits; Developer and Business include signed transforms and custom domains. Commercial use requires Business.