Get Started Get Started

Optimizing Images For Web

Smaller image files help your website load quickly for visitors and search engines. This guide is for anyone adding images to an Oncord website.

Why Image Size Matters

  • Large images slow down your pages, and search engines favour faster websites.
  • Large images use more storage and bandwidth, which can increase your hosting costs.
  • A page with many large images can be slow to scroll and slow to edit.

What Oncord Does Automatically

  • When you upload a JPG or PNG image, Oncord compresses it to reduce the file size with minimal quality loss.
  • When a page shows an image at a smaller size than the original, Oncord serves a resized copy.
  • Oncord lazy loads images by default. See Lazy Loading Images below.

You can improve on this by choosing the right file format and uploading images at a suitable size.

How to Optimise Images for Web Use

The aim is to make the file as small as possible without a visible loss of quality, such as pixelation or blurriness. Three things affect the size of an image:

  • The file format, usually .png, .jpg, .webp or .svg.
  • The amount of compression applied.
  • The resolution, meaning the width and height of the image.

These applications are often used to resize images or change their file format:

These links are provided for convenience and information only.

Choosing a File Format

Oncord supports all common image formats. The right format can greatly reduce the size of an image while keeping its quality. These four formats suit the web.

JPG Images

JPG suits photographs and images with many colours, gradients, shadows and fine detail. It is usually the best choice for high-quality product photos and portfolio images.

JPG doesn't support transparency, so it doesn't work well for logos or icons.

In most apps, you can adjust the compression when you export a JPG, which trades file size against image quality.

JPG Photograph:  51kb
PNG Photograph:  135kb

Photo provided by Hugh Whyte via Unsplash.

PNG Images

PNG supports transparency and suits icons, logos, and some digital illustrations and software screenshots.

PNG images often look sharper than JPG images. However, photographs and detailed images are usually much larger as PNG files.

JPG Logo: 11.4kb

PNG Logo: 3kb 

SVG Images

An SVG file is closer to a web page than to the formats above. It contains code that describes the shapes, lines, fonts and colours that make up the image.

SVG supports transparency and suits logos, icons and some digital images. Where possible, an SVG logo gives the highest-quality result.

SVG Logo: 4.2kb


Keep these limits in mind:

  • An SVG usually needs a designer to produce, and the format doesn't suit photographs.
  • A JPG or PNG embedded in an SVG still behaves like a JPG or PNG. It won't scale without artefacts or look any sharper.
  • Converting an image to SVG means redrawing its shapes so they are coded correctly, usually by a designer.
  • Most email programs don't support SVG, so avoid it in email campaigns.

WebP Images

WebP was designed for the web, to reduce file size while keeping image quality high. In most cases, a WebP image is smaller than the same image as a JPG or PNG.

  • Current browsers support WebP (see browser support), so it's fine to use across your website unless you need to support older devices and browsers.
  • You can export WebP files as lossless, or with a chosen amount of lossy compression, to balance image quality and file size.
  • WebP supports transparency, and an animated WebP can be much smaller than a GIF.
  • Email programs don't support WebP well, so avoid it in email campaigns.
  • WebP was designed for the web, so it isn't ideal for offline use.

Artefacting

When a JPG image is shown smaller or larger than its actual size, visual artefacts and blurriness appear. PNG images show fewer artefacts, but lines start to look jagged.

To see the difference, hover over the MuzosDirect logos above and look closely at the edges of the shapes and letters. The SVG logo stays much clearer and scales without artefacts.

Image Compression

Compression simplifies the data that describes an image, which can greatly reduce its file size. Light compression is very hard to see. Heavier compression removes more data, so quality drops and blurriness and artefacts appear.

Oncord compresses JPG and PNG images automatically when you upload them. To compress images before uploading, these tools are a common choice:

Image Width & Height

Image width and height are measured in pixels (px). For example, 400 x 600 means 400px wide and 600px tall.

If you work with a designer, they may give you sizes to suit your website. Otherwise, the guidance below suits most websites. Only widths are listed, because on the web an image's height scales with its width as the screen size changes.

The right size depends on your priorities. A designer or architect showcasing their work may choose larger, higher-quality images. A website for a consultant or accountant that needs to rank in search results would usually favour page speed.

Typical Image Sizes to Favour Page Speed

  • Large images, about 1400px to 1800px wide - For full-screen banners and background images that fill the width of the screen. Larger 4K screens will stretch the image, but in a background this usually isn't noticeable. If you notice too much quality loss, use a width closer to 1800px.
  • Other images, about 600px to 800px wide - For general images placed throughout your pages that aren't shown full screen.

Typical Image Sizes to Favour Image Quality

  • Large images, about 1800px to 3840px wide - For full-screen banners and background images that fill the width of the screen. At 3840px wide, the image doesn't need to stretch, even on larger 4K screens. Keep an eye on your bandwidth usage at this size, because the files are larger even with compression.
  • Other images, about 800px to 1200px wide - For general website images with a clear, higher-resolution look.

Benchmarking Your Changes

Google's free PageSpeed Insights tool measures how quickly your pages load. Run it before and after you optimise your images to compare the results.

To find the files that use the most bandwidth on your website:

  • Go to Dashboard > Settings > My Account.
  • Under Hosting Plan Usage, click View Details in the Bandwidth panel.
  • Review the Heaviest Files list.

Lazy Loading Images

Lazy loading helps a page with large images load quickly. Oncord first shows a small blurred preview of the image, then shows the full-quality image once it has downloaded, so the rest of the page doesn't wait for it.

Every image starts on Auto, so images without a fixed width or height already lazy load. You don't need to go back through your existing images.

To change when an image loads:

  • Open the page in the page editor.
  • Select the image.
  • In the left sidebar, choose an option under Lazy Loading:
    • Auto - The image lazy loads only when it doesn't have a fixed width or height. This is the default.
    • After Page Load - The image loads once the rest of the page has loaded.
    • When Scrolled Into View - The image loads when it is about to appear on screen.
    • Off - The image loads immediately.
  • Click Save.

Lazy loading works best with larger images, over 1 MB in size.

When Scrolled Into View is only offered for images you upload or insert in the editor. It isn't available for images added as HTML code.