Categories: Linux

How to resize multiple image with single command

I tend to be lazy .. hehehehe..

sometime I took a lot of picture then later don’t know how to select and post ..
some more need to resize each one of them before publish or send out to somebody else..

figured out.. by creating a simple bash script file with following content :

~/bin/resize_my_images.sh

for i in `ls  *.JPG`
do
convert -verbose -resize 50% -comment "(c) HawkEYE Expression's" $i resized_${i%%.*}.jpg
done

* Updated to fix the filename extension to lower-cased..

Then have make it executable .. before can use .. by issuing this command.

chmod a+x  ~/bin/resize_my_images.sh

to use it..

cd ~/where/to/image_folder/
~/bin/resize_my_images.sh .

it will take every single JPG file in the folder and resized it by 50% .. and renamed to resized_original_name.jpg
quite handy when to handle let’s say 300+ images…

p/s : can remove verbose string if don’t want to know the progress of the conversion process..
btw .. dependencies is :

[root@nb-namran ~]# rpm -q --whatprovides /usr/bin/convert
ImageMagick-6.2.8.0-4.el5_1.1
Namran Hussin

Leave a Comment

View Comments

Share
Published by
Namran Hussin
Tags: bash script

Recent Posts

How you can speak with clarity and influence

Here are five key communication skills that help you speak with clarity and influence: Speak…

7 months ago

? Man360 Academy Q&A Session Video Access – Empower Your Masculine Growth Journey

Are you ready to unlock your full potential as a man?Discover powerful insights, real-life transformations,…

1 year ago

A note to remember

One day we will set aside one whole day to review the whole lesson we…

1 year ago

Dev Fest KL 2024

Last weekend, 07/12/2024 I managed to join Dev Fest Kuala Lumpur 2024, organized by Google…

1 year ago

TIPS BACAAN AL-QURAN

TIPS BACAAN AL-QURANOleh: Dr. Muhd al-Muhaysni.1. Jangan engkau berikan (fokus membaca) al-Quran pada lebihan waktumu…

2 years ago

Selawat 300 ribu kali

Selawat yang ringkas, yang mana apabila kamu membacanya satu kali sebanding 100 ribu kali, jadi…

2 years ago