credit card
How to protect your credit/debit card from being stolen on the internet
March 11, 2012
8 ways protect yourself against malware
8 ways protect yourself against malware
March 11, 2012
Show all

How to Batch Resize and Watermark Images in Linux with Commandline

You have a lot of photos so you want to post them to a website but the photos are very large and will make over a day to be uploaded to your site. Also you maybe not want to steal your photos so you want to add a watermark with a word or your site or perhaps your logo. You can do all this stuff and much more through Linux.

You will need imagemagick to accomplish this.

Download and install imagemagick typing this in your console of your linux distro.

sudo apt-get install imagemagick

after typing your password and installing successfully the package then don’t exit the console but go to the folder where the images are stored.

So if you have them put on your desktop in some folder named images then go in your console typing

cd ~/Desktop/images

After that you are ready to convert the images. So to convert them type in your console

mogrify -resize 500x500 *.jpg

this command will resize all images with a jpg extension to the dimensions of 500 pixels. This means that your images will be not larger than that dimensions. This command also preserves the aspect ratio. So you have no problem. Try it.

Now you want to apply to them some watermark. Type the following command in your console.

 convert *.jpg -font Arial -pointsize 20 -draw "gravity south fill black text 0,12 'I Got Answers' fill white text 1,11 'I Got Answers'" new.jpg 

This command will apply to all images with a jpg extension the text “I Got Answers” text and with a little black shadow because I apply the text 2 times one black (background) and one smaller white (foreground). Also the text will be applied to the center and bottom position of the image (“gravity south”)

You can find more if you visit the imagemagick site.

Did you like this page ? Let your best friend know !

Leave a Reply

Your email address will not be published. Required fields are marked *