Innovative Open source WEB technologies for everyone

IOWEB Technologies

with our news and our solutions

Batch Photo Resize - Powershell v3 Script for Windows

Introduction

A lot of times our customers struggle with resizing images so that they can properly upload them to Magento products. Sometimes their suppliers give them either too big or uneven photos making it hard to them to produce a good result. Usually we can ask Magento to resize the images before serving them to the visitors however we believe it’s better to upload images in the correct size in the first place.

So we decided to write a small powershell script that will automatically resize all images in a folder to 1000 x 1000 px. This is a reasonable dimension for a website’s product images for most cases unless you require really high resolution zooming to view textures and other details.

Requirements

In order For this script to work you need to install the following prerequisites if you don’t already have them:
  1. Powershell v3+: If you have windows 10 you have powershell v3 but if you have older windows you might need to upgrade it from Microsoft’s website.
  2. ImageMagix Liberary: This script uses the ImageMagick library to resize the images so it needs to be installed in your system. If you’re using make sure you download the correct Library version depending on your windows architecture (32bit, 64bit) from the official website.
  3. Notepad or similar text editor

You can download ImageMagick here.

           

Installation

The script doesn’t need any special installation. Just download it here, rename it to resizer.ps1 and then copy it to the directory where the images you want to resize are.

How To Use

Copy the script “resize.ps1” to the folder containing the images you want to resize. Right click the file “resize.ps1” and click on “Run with Powershell”. The script will automatically resize all photos in that folder and put them in a subfolder called “resized”. The script is non-destructive and your old photos will remain untouched.

Adjusting dimensions for output images

By default the script will adjust the image canvas size to have a 1000x1000 px size and will add white background to the canvas to make them so. If you want you can alter the sizes by editing the script using notepad 

and In line 19:
magick "$oldPath" -resize 1000x1000 -background white -gravity center -extent 1000x1000 "$newPath"
change “1000x1000” to your desired dimension.
If your images have black background, you can also change the parameter
“-background white”
To:
“-background black”
to add black color to the canvas instead of white.

Ioweb Technologies

IOWEB TECHNOLOGIES, located in Thessaloniki and Athens, are a team of experienced, professional web developers that deployed many corporate websites, b2b and b2c e-commerce systems and web applications.

We started our company when we noticed that many businesses experience dificulties finding partners that are as commited to long - term partnerships as they need them to be.

Find Us

IOWEB TECHNOLOGIES P.C.
Manou Loizou 16, Nikopoli
ZIP: 56430
Thessaloniki

Reg. No. 156550206000

Tel: +302313113732

Working Hours

Monday-Friday: 9:00 - 17:00
© 2015-2022 IOWEB TECHNOLOGIES P.C.

We use cookies to give you the best online experience. By agreeing you accept the use of cookies in accordance with our cookie policy.

Privacy Settings saved!
Privacy Settings

When you visit any web site, it may store or retrieve information on your browser, mostly in the form of cookies. Control your personal Cookie Services here.

This cookies are necessary for the operation of the website and cannot be disabled

Αυτά τα cookies είναι απαραίτητα για τη λειτουργία του ιστότοπου και δεν μπορούν να απενεργοποιηθούν.
  • wordpress_test_cookie
  • wordpress_logged_in_
  • wordpress_sec

Decline all Services
Accept all Services
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram