How to Resize Images after Import With Imagick (ImageMagick) for Magento 2

- Magento 2, Our extensions

In the following article, we explore how to resize product images in Magento 2 in the most user-friendly way. If you still reduce the size of high-resolution product photos manually before uploading them to your e-commerce website, you’ve come to the right place. We will teach you how to automate this process. Spoiler: you will need to install the Improved Import & Export extension and Imagick for Magento 2. If for some reason you still use product pictures as they are, you will find out why it is crucial to resize images in Magento 2. You can find more tips like this one in our Magento 2 Developer’s Cookbook.

Why it is important to resize product images for your Magento 2 website

Image sizing is everything for an average blog, not to mention an e-commerce website that contains hundreds of product images. Large file sizes cause your website to load slowly. What does it mean? 

47 percent of consumers anticipate a web page to load in less than two seconds. Different studies show that 40% of people quit websites that take more than 3 seconds to load. It means that you may lose up to 40% of potential customers if you use heavy product images on your Magento 2 website. But you can’t afford to lose revenue because of something as simple as huge image file sizes, are you?

Resize Images After Import: The Option’s Definition & Impact

As we already mentioned, you can easily solve the problem of heavy images with the help of the Improved Import & Export extension and Imagick for Magento 2. Let’s focus on the first tool. 

Our module provides the ability to resize product images in Magento 2 in just one click after you import them. It is only necessary to activate the corresponding feature – “Resize Images After Import”.  It appears when you select products as your import entity.

Turn on the feature, and the extension will leverage Imagick to compress your product images without affecting Magento’s performance. We will explain how to activate the magic time-saver further in this post. Now, let’s a few words about Imagic for Magento 2.   

What is Imagick?

Magento 2 Imagick

Imagick is a PHP plugin designed to generate and alter pictures using the ImageMagick API. ImageMagick, in turn, is a software package for creating, modifying, and composing images that can read, convert, and write formats such as DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF. The tool is available for free. 

How does Imagick work?

Imagick’s OO interface makes image manipulation in PHP exceedingly simple. It is straightforward to resize all files in a directory using the SPL and other OO capabilities of Imagick. And it is extremely helpful for batch resizing huge digital camera photographs to be web-readable formats and optimum sizes.

Imagick for Magento 2

Although you won’t find an ImageMagick plugin in the official Magento 2 marketplace, you need to look for it in another place. Meet the Imagick – the most famous PHP extension designed to create and modify images using the ImageMagick library. By installing this PHP extension, you introduce ImageMagick to Magento 2.

When Imagick for Magento 2 is installed, the Improved Import & Export module adds the option to resize product images after the import process. In addition to size manipulations, the library can help you add watermarks. Once the library is installed, the Improved Import & Export extension handles the rest.

Learn how to install and use the Imagic PHP7 library for Magento 2

How to Resize Images after Magento 2 Import 

The whole process of resizing is reduced to a single click – you only need to enable the corresponding feature as described below: 

  1. Under System -> Improved Import/Export -> Import Jobs, create a new import job (“Add New Job”).

  2. Enable your job, type its title, and set the update frequency if applicable on the General Settings tab.

  3. Now, go to the Import Settings tab and choose Products as your import entity. Additional settings display.
    Magento 2 Products add edit import export

  4. Scroll down to the “Resize Images After Import” option. Enable it to compress product images that you import to Magento 2.
    Resize Images After Import in Magento 2
  5. Configure other parameters and save your import job.

Now, you can import products to Magento 2, resizing their images. For further information on how to import products to Magento 2, follow this link: The Complete Guide to Magento 2 Product Import.

Improved Import & Export Features

The option to resize product photos isn’t the only benefit of Improved Import & Export. As previously stated, the plugin thoroughly redesigns Magento’s import and export practices. 

First of all, you may avoid time-consuming and unpleasant file modifications.  Although Magento 2 only accepts CSV files (all files must be converted to this format before being imported), the Improved Import extension allows you to import and export files of several formats, including CSV, XML, JSON, ODS, and XLSX.

In addition to that, numerous file sources are at your service. Google Drive Dropbox, FTP/SFTP, direct file uploads, or URL uploads can become points of exchange for your data files. Alternatively, you can rely on  Google Sheets to import products and other entities: 

Magento 2 Products add edit import export

You may avoid utilizing third-party services by using the addon. Import & Export allows direct API transfers when you link your e-commerce website directly to external systems, giving a whole new technique to import and export operations between Magento 2 and external systems.

Scheduling is another useful innovation seen in every import and export operation. It enables you to automatically update your e-commerce website at a predetermined period. 

Not to mention the extension’s rich mapping features, which allow you to convert third-party properties to Magento 2 attributes or even create new attributes and values if necessary. For further information, click on the following links: