3 Simple Image Manipulation Tricks When Using ImageMagick

ImageMagick is a tool well-known to most PHP Developers, thanks to its versatility when it comes to image operations.

#1: Watermark Your Images

If you consider copyrighting your images a necessity, then it’s a good idea to add a watermark. Here’s a command that can help you do this easily: convert kid2.png -font Arial -pointsize 70 -draw “gravity south fill black text 0,12 ‘Copyright’ fill white text 1,11 ‘Copyright’ ” out.jpg

#2: Batch Resize Images

Resizing images can be tedious especially if you have to resize a large number of them one by one. This is where ImageMagick can do this for an entire batch by using a simple command: mogrify.

Some of the manipulations include resize, flip, blur and so on and so forth but care must be taken to pick a different output format lucky club online casino or else the original files will overwritten.

The command for resizing images is: mogrify -resize 50% -format jpg -path resized *.jpg

This will place the resized images into a separate resized folder.

Another way to do this is by specifying the size of the output images as well. Here’s the command to do it in this way: mogrify -resize 400*300! -format jpg -path resized *.jpg

#3: Brighten, Sharpen or Crop an Image

While there are several software products that can carry out these tasks, you can use ImageMagick to perform these operations too.

The command you can use to brighten your image by 125%: convert kid.png -modulate 125% bright.jpg

The command you can use to sharpen your image: convert k2.png -unsharp 1.5×1.0+1.5+0.02 sharp.png

The command to crop an image: convert k2.png -crop 150×150+30+10 crop.png