Linux Script for resizing images / photos

 IT, Linux  Kommentare deaktiviert für Linux Script for resizing images / photos
Apr 112013
 

Hi there,

here a script that wl resize images (to 25% of original size) and moves the resized images o a folder called „25Prozent“:

#!/bin/bash

cd $1
echo "Starting Script for resizing Images to 25% of the origin size"
echo "Creating folder -> 25Prozent <-"
mkdir 25Prozent
echo "Folder created"
echo "*** Start resizing images ***"
for i in *.JPG;do convert $i -resize 25% -quality 95 25Prozent/$i;echo $i;done
for i in *.jpg;do convert $i -resize 25% -quality 95 25Prozent/$i;echo $i;done
echo "*** Finished resizing images ***"
echo "exit and good bye..."

Instead of

for i in *.JPG;do ....
for i in *.jpg;do ...

You can also use:

for i in $(find . -iname "*.jpg")

Thx to Timo for this information 😉

Resize images

 Linux  Kommentare deaktiviert für Resize images
Jan 162010
 

Often you have to resize images from a camera for using them on a website or a gallery or if you want to send them via email.

With the following command you can easily resize images inside of a directory ( the „imagemagick“ package must be installed on your system ).

for i in *.jpg; do echo "$i"; convert "$i" -resize 25% "$i"; done

(in some shells you have to remove the “ form $i):

for i in *.jpg; do echo $i; convert $i -resize 25% $i; done

If you would like to store the resized images in a separate folder, you can use these two commands:

// create folder with name resized
mkdir resized

//resize images and store the in folder resized
for i in *.jpg; do echo $i; convert $i -resize 25% resized/$i; done

The „echo $i“ print out the files on the terminal.