swiftimg

Image hosting for SvelteKit — @sveltejs/enhanced-img with a remote source

SvelteKit's `@sveltejs/enhanced-img` optimises in-repo images at build time. For remote sources, swiftimg is the drop-in: just an `<img src=…>` that points at a CDN with transforms.

Try swiftimg freeSee the API

Heads-up

If your images live in `src/lib/images`, `enhanced-img` is the lowest-friction choice. swiftimg fits when images are uploaded outside the build (user content, CMS, mobile).

Step by step

  1. 1. Use a plain <img> with the swiftimg URL

    No SvelteKit config needed for remote URLs — they're just strings.

    Component
    <img src="https://i.swiftimg.com/abc123.png" alt="..." width="1200" height="630" />
  2. 2. Generate a responsive srcset

    On the Developer plan, build a srcset from width hints.

    Component
    <img
      src="https://i.swiftimg.com/abc123.png?w=1200&sig=..."
      srcset="https://i.swiftimg.com/abc123.png?w=480&sig=... 480w,
              https://i.swiftimg.com/abc123.png?w=1200&sig=... 1200w"
      sizes="(max-width: 600px) 100vw, 1200px"
      alt="..." />
  3. 3. Upload from a SvelteKit server route

    Use a +server.ts endpoint to push files to /v1/images via the REST API with your API key.

SvelteKit — FAQ

Will @sveltejs/enhanced-img still work?

Yes for in-repo images. enhanced-img doesn't process remote URLs, so swiftimg sits next to it for everything coming from outside the build.

Can I use swiftimg URLs with adapter-static?

Yes — the build output just embeds the absolute URL. swiftimg delivers globally regardless of host.

Does Vite's image-import plugin help?

Only for files imported at build time. Use it for in-repo art and swiftimg for content uploaded after deploy.

Go ad-free with Pro

Remove ads & unlock more — from $3/mo.

See Pro

See also

Hosting for SvelteKit 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 SvelteKit images?

Start free, then unlock the full API, transforms, signed URLs, and a custom domain on the Developer plan.