Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A Batch Script To Resize Images [closed]

Tags:

I'm looking for some help in writing a batch script to resize a bunch of .jpg images.

I don't have much experience with batch scripts. But this task will be preformed on a windows machine & so I thought a batch script might be a good way to go.

I'm always interested in hearing alternative ideas & approaches, or being made aware of elements I haven't thought of.

Below I have listed the basic steps/needs of the script:

1) The images are located in a folder & are all(or should be) 500 x 500.  2) I need copy & past the images to a new folder, where they will be resized to 250 x 250.  3) I then need to repeat step 2 but this time resize to 125 x 125. 
like image 583
Reed Williams Avatar asked Nov 07 '16 02:11

Reed Williams


People also ask

How can I batch resize photos?

Click the first photo, then hold down your ”CTRL” key and continue single-clicking on each photo you wish to resize. Once you have chosen them all within a specific folder, let go of the CTRL button and right-click on any of the photos and choose ”Copy”.

How do I batch resize multiple images in Photoshop?

Resize multiple images by batch processing them Now you can batch process your images to resize them all. To do this, open Photoshop, then go to File > Automate > Batch. You should now see the Batch window. Choose the set that you created your action in, and then choose your action.

How do I batch resize images in python?

You can resize multiple images in Python with the awesome PIL library and a small help of the os (operating system) library. By using os. listdir() function you can read all the file names in a directory. After that, all you have to do is to create a for loop to open, resize and save each image in the directory.


2 Answers

Once you install ImageMagick for Windows, you can use magick command-line tool, e.g.

magick.exe mogrify -resize 250x250 -path 250x250/ *.png *.jpg magick.exe mogrify -resize 125x125 -path 125x125/ *.png *.jpg 

Note: Make sure your magick.exe command is in your PATH system variable and you're pointing to the existing or created the destined folders (e.g. mkdir 250x250/ 125x125/ in above case).

For Linux/Ubuntu, see: How to easily resize images via command-line?

like image 133
kenorb Avatar answered Oct 02 '22 05:10

kenorb


Use Image Resizer for Windows:

enter image description here

enter image description here

like image 28
Ricardo Ortega Magaña Avatar answered Oct 02 '22 05:10

Ricardo Ortega Magaña