Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

For an image that needs a stable URL, put it in a public/ directory at the project root and reference it from the site root—for example, public/images/hero.jpg becomes /images/hero.jpg. The folder stays beside src/, app/, or pages/; it never appears in the browser URL. You can also keep a local image beside the component and statically import it, or use a remote URL with explicit sizing and an allowed host pattern.

The three supported places for images

Choice File location How you reference it Best fit
Public static asset <project-root>/public/... A root URL such as /images/hero.jpg Logos, favicons, social images, downloads, and files that other systems must fetch by a predictable URL
Imported local asset Beside the component or module that owns it Import the file and pass the imported value to next/image Component-specific artwork that should live with its code
Remote asset An external image host The complete remote URL Images already managed by a CMS, object store, or another service

The right choice depends on URL addressability, ownership, and whether the bytes are local to the repository. All three can be used in one application.

Using the public folder

Where the folder belongs

Create public at the project root, next to package.json and (if you use one) src:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
project/
  public/
    images/
      hero.jpg
    avatars/
      me.png
  src/
    app/
      page.tsx
  package.json

Next.js serves files in this directory from the site root. A file at public/profile.png is requested as /profile.png, not /public/profile.png. Likewise, public/images/hero.jpg is /images/hero.jpg.

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Rendering a public image

import Image from 'next/image'

export default function Profile() {
  return (
    <Image
      src="/avatars/me.png"
      alt="Profile photo"
      width={64}
      height={64}
    />
  )
}

Use a leading slash and do not write ./public or /public. The same URL works from a route in app or pages; URLs are relative to the deployed site, not to the component file.

When public is the better option

  • You need a stable URL for a logo, manifest image, Open Graph file, robots-related asset, or downloadable file.
  • A CMS, email, CSS file, or third-party integration must refer to the asset without importing JavaScript or TypeScript.
  • Non-code content editors will replace files while keeping the URL convention.

Choose descriptive subdirectories such as public/images, public/icons, and public/fonts. The directory name is not special after the root mapping; organization inside it is yours.

Projects that use src/

Putting application code in src/app or src/pages does not move static assets. Keep public beside src:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
project/
  public/
    images/hero.jpg
  src/
    app/
      page.tsx

If both a root-level app (or pages) and a corresponding directory under src exist, Next.js uses the documented directory convention rather than combining them. Keep one routing location to avoid debugging the wrong file.

Keeping an image beside its component

For a local image owned by one component, use a static import. Next.js can read the imported file’s intrinsic width and height and pass that metadata to next/image:

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
import Image from 'next/image'
import profileImage from './profile.png'

export default function ProfileCard() {
  return (
    <figure>
      <Image src={profileImage} alt="Profile photo" />
      <figcaption>A profile photo</figcaption>
    </figure>
  )
}

Static dimensions let the image component reserve the correct aspect ratio before the file arrives, helping prevent layout shift. This approach also makes the ownership relationship obvious: moving or deleting the component exposes an unused asset during normal code review.

Public URL or static import?

  • Use a public URL when another system needs to know the address or when the file is site-wide.
  • Use an import when the image is a component implementation detail and should move with that component.
  • Do not write a string path such as "./profile.png" in src and expect the browser to resolve it; either import it or place it under public.

Using remote images

An external URL is valid in the src prop, but Next.js cannot inspect that file during your build. Give the image dimensions or use fill, and allow the host and path pattern in your image configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import Image from 'next/image'

export default function ProductImage() {
  return (
    <Image
      src="https://cdn.example.com/products/widget.jpg"
      alt="Widget product"
      width={1200}
      height={800}
    />
  )
}

Configure only the domains and paths you actually use. In a current Next.js project, that is commonly done with remotePatterns:

// next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'cdn.example.com',
        pathname: '/products/**',
      },
    ],
  },
}

module.exports = nextConfig

Restart the development server after changing the configuration. Keep the pattern specific: allowing an entire internet host when you only need one path makes accidental or untrusted URLs easier to use.

When to use fill

Use fill when the image should occupy a positioned parent rather than dictate its own dimensions. The parent needs a positioning context and a defined size:

Rank #3
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.
<div className="relative h-64 w-full">
  <Image
    src="https://cdn.example.com/hero.jpg"
    alt="Mountain landscape"
    fill
    sizes="100vw"
    style={{ objectFit: 'cover' }}
  />
</div>

For responsive layouts, provide an accurate sizes value so the browser can select an appropriate generated image. Without either explicit dimensions or fill, remote images cannot establish their aspect ratio safely.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can images go inside the app folder?

Yes, as imported assets. A file such as src/app/about/team.jpg can be imported from a component in that route (subject to your project’s supported image file handling). It is not automatically available at /about/team.jpg merely because it sits under app. If you need that predictable URL, move the file to public/about/team.jpg and request /about/team.jpg.

Route-specific files such as a component’s hero artwork are often clearer as imports. Site-wide files and files referenced by metadata or external tools are usually clearer in public.

Images in CSS, metadata, and other files

CSS

CSS can address a public asset directly:

.hero {
  background-image: url('/images/hero.jpg');
}

A CSS file cannot generally use a React import variable. If the stylesheet needs a URL string, place the asset in public or use the bundler-specific asset workflow supported by your setup.

Metadata and social previews

When a crawler or social platform needs a URL, use a public path or a fully qualified deployed URL. Do not expose a development-only path such as /public/images/card.png. Verify the final URL in the deployed environment, including any base path configured for the application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Cache behavior and changing files

The current App Router guidance says Next.js cannot safely cache files in public because they may change and documents the default response as Cache-Control: public, max-age=0. Treat this as version-sensitive: check the documentation for the Next.js version you deploy rather than copying cache values from older, versioned pages.

If an image must be aggressively cached, use immutable, content-hashed filenames (for example, logo.8f31c.svg) or configure caching at the CDN or server layer you control. When replacing a file without changing its URL, browsers and intermediary caches may continue to show the previous bytes.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common errors and fixes

“Image Optimization using … is not configured”

Cause: the remote hostname or pathname is not allowed. Fix: add the exact protocol, hostname, and required path to images.remotePatterns, restart Next.js, and check that the runtime URL matches the pattern character for character.

404 for a file that exists under public

Cause: the URL includes /public, the file is in the wrong project root, or capitalization differs. Fix: map public/x/y.png to /x/y.png, confirm the folder is beside package.json, and match case exactly (especially on Linux deployments).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“Required width and height” or a layout jump

Cause: a remote or dynamic image has no intrinsic dimensions. Fix: provide accurate width and height, or give a correctly sized positioned parent and use fill. A static import can supply dimensions automatically for local files.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

The image is clipped or distorted

Cause: CSS dimensions do not match the source ratio, or object-fit is missing with fill. Fix: preserve the source ratio, choose objectFit: 'cover' for intentional cropping or 'contain' to show the complete image, and test the smallest supported viewport.

The new image appears locally but not in production

Cause: the file was ignored by version control, generated outside the deployed project, or the production URL has a base path. Fix: verify the file is committed, inspect the build artifact, open the exact production URL, and account for any configured base path when constructing links.

A practical decision checklist

  1. Does another system need a stable URL? Put the file in root-level public.
  2. Is the file owned by one component and used through next/image? Keep it nearby and statically import it.
  3. Is the source already on a CMS or CDN? Use its remote URL, configure a narrow allowed pattern, and provide dimensions or fill.
  4. Will the bytes change at the same URL? Plan cache headers or versioned filenames before launch.
  5. After deployment, test the actual URL, not only the development server.

Need a screenshot of the rendered page?

If your reason for organizing images is to document or test the resulting page, you can capture the deployed URL without setting up a browser locally.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Or skip the browser setup

ScreenshotNeo accepts one GET request and returns a PNG, JPEG, WebP, or PDF. It removes cookie-consent banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and the response identifies the page and billing result in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. See the ScreenshotNeo documentation for options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://example.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

Every plan includes the full feature set. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

Frequently Asked Questions

Should I put images in src or public?

Use public for predictable, externally addressable URLs. Use a static import in src when the image belongs to a specific component.

What URL maps to public/images/logo.svg?

Use /images/logo.svg; never include /public in the browser URL.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can next/image load an image from any remote URL?

It can load remote images only after the host and path are allowed in your image configuration, and you must provide dimensions or use fill.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.