img.logo.dev, so the image never passes through your server. Render next/image with the unoptimized prop, or use a plain <img>.
Prerequisites
- A Next.js app.
- A Logo.dev publishable key:
Get your API keys
Your dashboard has a publishable key for the Logo.dev CDN and a secret key for the Logo.dev API. Every plan includes both.
1
Store your publishable key in an env var
A publishable key is safe in client code. Prefix the variable with
NEXT_PUBLIC_ so client components can read it:.env.local
2
Render the logo
Pass the domain and your publishable key to With
next/image, and set unoptimized. Set width and height, since next/image requires them for remote images:CompanyLogo.tsx
unoptimized, you need no change to next.config.js.Skip the optimizer
Withoutunoptimized, the Next.js Image Optimization API fetches each image on your server and passes it on to your users. Fair use does not allow this for img.logo.dev. The Logo.dev CDN already serves sized, cached images, so the optimizer adds nothing.
If you added img.logo.dev to images.remotePatterns, remove the entry. Next.js then rejects any next/image that sends a logo through the optimizer.
A plain <img> also loads the logo in the browser:
size, format, and theme parameters on the URL.
Canvas and OG images
A logo drawn on a<canvas> needs crossorigin="anonymous". An Open Graph image from next/og needs the logo file on your server, so get it from the Logo.dev API, not the CDN. CORS, canvas, and CSP covers both cases.