Image Resizing with XnConvert

Looking for a tool to resize either a folder of images or a single image, which I can recommend to my customers, I read about XnConvert.

The requirement is to be able to convert images for use on websites. Ideally conversion should have a quality option, to reduce the memory size of the saved image.

The program should be ready to use. A Linux shell script or Windows batch file are not options. For example my previously developed and used an image resizing script based upon the Linux ImageMagick convert command, would not be a choice which I want to offer.

Performing individual image transformations using a graphics program such as Photoshop or The Gimp is either too expensive or the overall process would be time consuming and complicated.

Automating the conversion process will simplify the task and make it repeatable.

XnConvert

XnView image Tools

I recently read an article suggesting the use of XnConvert, a batch image conversion tool. Able to manipulate multiple images in a number of different formats and actions. XnConvert is part of the XnView range of image tools.

XnConvert is available for Windows, Mac and Linux. Cross platform compatibility will make support much easier.

Downloads of XnConvert are available on the site’s downloads page.

I installed the Debian Linux version. All proceeded as expected. I was then able to test convert a directory of images, residing them to a smaller size.

The XnConvert interface gives tabbed based windows with options for:

  • Input
  • Actions
  • Output
  • Status
  • Settings
  • About

I wanted to resize a folder of images to the limit of either the horizontal or vertical edge, whichever the greater.

The canvas is to be sized with a background colour.

Select Images

The program starts with a view of the empty Input tab view.

On this page click on either the button to Add files or to Add folder. I chose to add a folder.

XnConvert Input Tab add Directory

In the popup window navigate to the folder to be converted. Image files are not shown in this view.

Once the folder is selected by clicking on the Choose button the input tab window is populated with images from the selected folder. As shown in the image below.

XnConvert Input Tab

Select Output Options

Click on the Output tab to select the output folder and options associated with the saved files.

XnConvert Output Tab

The Output tab view, shown above, has the folder selection at the top.

Other options given are:

  • filename, take the filename as is or add a date and time stamp
  • file type (format). XnConvert maybe used to convert images from one format to another, for example jpg to png.
  • other options, I left the option to ask before over writing files.

Click on the radio button to select Folder. You may find your output folder listed in the drop down list of previously used folders. If not click on the ellipses button to the right of the textbox.

Select your output folder. It will be remembered for your next batch image conversion too!

XnConvert Output Tab Choose Pathname

For jpg images to be saved to the web you may wish to change the saved quality to between 70% and 80%. This will create an image of a smaller file size lending to a web page with a lighter ‘weight‘. Which will load faster.

Configure Actions

XnConvert Actions Tab

Click on the Actions tab, to view and add actions to be performed on the selected images. Actions are run sequentially on the image. The order may be significant. In the image above two actions are shown.

The original requirement was to resize an image to best fit a letter box boundary and to subsequently resize the canvas to match the letter box.

On this page first click on Add action and select Image, followed by Resize.

The options required here are:

  • Mode – fit
  • Width – as required
  • Height – as required

Next add the Canvas resize action.

This will use Custom presents, with the width and height set to the same values as per the resize, already configured.

The result needs to be centred.

Ensure that both actions are enabled.

When you are ready to convert your image files click on the Convert button on the Actions tab.

Best Fit Image Resize

Commonly an image is resized to fit a new boundary size. A little like fitting to a letter box.

In the example below the image is to be resized to fit the green box.

Resizing Image Original and new Boundary

The image is resized such that there is no overflow.

Resizing Image showing new Boundary and added White Space

Its likely that this resizing will be imperfect leaving a gap either to the sides or above/below the image.

White space can be added to fill the missing gap. Creating an image of the correct size.