Images are an integral part of almost every website and contribute to providing visitors with a better user experience. Today, large photos are in vogue, but higher resolution comes with larger file sizes, leading to slower website loading times. The purpose of adding images is to enhance the user experience, but if the website loads slowly, it will not contribute to that goal, as many visitors may leave before the content fully loads.

To address this issue during website development, it is necessary to optimize each image that is uploaded. Image optimization involves reducing the file size without compromising its quality.

Benefits after image optimization:

  • Improved Page Loading Speed: The page loading speed will be enhanced
  • Better Search Engine Ranking: The website will rank higher in search engines due to improved performance.
  • Bandwidth Savings: Smaller file sizes will save both storage space and bandwidth on the server.
  • Faster Website Backups: Website backups will be faster.

The primary goal of optimizing photos is to find the right balance between minimizing file size and maintaining satisfactory quality. Typically, images are processed before being uploaded to the server through photo editing software. Some aspects can also be optimized later using WordPress plugins.

Choosing the right image format

Two things should be paid attention to: the image file format and the level of compression. In practice, the most commonly used formats are:

  • PNG format: It offers very good quality but has a larger file size. It is used when a transparent background is needed, such as in logos.
  • JPEG: A highly popular format for photographs, allowing excellent optimization without significant loss of quality.
  • GIF: It uses only 256 colors and is commonly used for animations.

In addition to the mentioned formats, WebP has become increasingly popular lately. It provides superior lossless compression (26% compared to PNG and 25-34% compared to JPEG). However, it’s worth noting that WebP is not compatible with all web browsers.

RReduce the size of the photo before uploading.

Modern cameras and smartphones capture photos in high resolution. However, for a website, it’s unnecessary to upload images in full resolution; instead, choose a resolution that fits the requirement. For galleries, resolutions like 800 x 533 px or 1200 x 800 px can be suitable.

For full-width slides that span from edge to edge of the screen, it’s recommended to use photos with a width of 1920 px. When creating sliders, it’s good practice to limit the number of slides and not use more than 4 to 5 photos. For this purpose, you can utilize free image editing software such as FastStone Viewer

Reduce file size using compression.

After selecting the desired file format and size, it is necessary to compress the photos to reduce the file size.

It’s important to know which compression method to use – Lossy or Lossless. Lossy aggressively removes some data that may not be visible to every eye, but it significantly reduces the file size. On the other hand, Lossless is a filter that compresses data without losing quality, but the file size savings are generally smaller.

The best approach is to conduct tests for each format and use the “Save for web” option available in some photo editing programs, such as Adobe Photoshop. You can experiment to find the right balance between quality loss and file size.

If an image on your website loads slowly, it’s a sign that you may need to either reduce the resolution or use compression, or possibly both. Another tool that could help is the TinyPNG web service, which allows you to further compress the size of PNG and JPEG images. One advantage of this service is that it can optimize up to 20 images at once.

 

tinypng sučelje

Automatic image optimization through plugins for WordPress

For the WordPress CMS, there are various plugins that automatically optimize images upon uploading to the server. The most popular plugins for this purpose include:

Before selecting a desired plugin, we recommend reading its documentation to understand how it works, as some may cause issues. It’s advisable to create a backup of your WordPress installation beforehand so that if any problems arise, you can restore the site to a point where those issues did not exist.

Lazy loading

Another method to speed up image loading is called lazy loading. This technique optimizes the content that is initially visible to the visitor, while delaying the download and display of content below the bottom of the screen.

Lazy loading works on the following principle – the web browser loads content without images or videos, and then, through JavaScript, determines which content is visible to the visitor during the initial load. This content is then preloaded. The download and display of additional images and videos are deferred until the visitor scrolls and views that part of the page.

In this case, there are numerous plugins for WordPress that enable lazy loading. You can try out the one that seems best suited for your website.

Include images in the sitemap

A sitemap, or site map, assists search engines in discovering new content, so it’s beneficial to include images in the sitemap. This will lead to images appearing more quickly in Google image search results, which contribute to about 10% of total search traffic.

Once you choose the right format and optimize images for the best website performance, your web pages will load faster, pleasing both visitors and search engines, potentially earning you rewards in terms of search rankings.