January 25, 2021
Hot Topics:

ImageMagick PHP Image Manipulation, Page 2

  • By Sachin Khosla
  • Send Email »
  • More Articles »

4. Brighten / Sharpen / Crop an Image in PHP

Need an alternative to Photoshop or another heavy software product for fine tuning your pictures? ImageMagick offers many of the same features in a lighter-weight utility. In this section, you are going to see how to brighten, sharpen and crop images in ImageMagick.

Here is the original image for the example.

ImageMagick PHP image manipulation

The following command increases brightness by 120%.

convert kid.png -modulate 125% bright.jpg

ImageMagick PHP image manipulation

The following command increases sharpness.

convert k2.png -unsharp 1.5×1.0+1.5+0.02 sharp.png

ImageMagick PHP image manipulation

The following command crops an image.

convert k2.png -crop 150x150+30+10 crop.png

ImageMagick PHP image manipulation

5. Frame an Image in PHP

I am sure you always wondered how Google's Picasa tool creates a cool collage of your images very quickly. Well, you can create the same effect using ImageMagick. See how I converted the original sample image to a cool bordered image.

ImageMagick PHP image manipulation

The command to create this frame is also simple:

convert kid.png -bordercolor white -border 6 -bordercolor grey60 -border 1 -background none -rotate 6 -background black \( +clone -shadow 60x4+4+4 \) +swap -background none -flatten frame.png

Explore More ImageMagick Tricks

The article provided just a few examples of ImageMagick. You can explore more ImageMagick features on ImageMagicks's Usage page.

Originally published on https://www.developer.com.

Page 2 of 2

This article was originally published on May 2, 2012

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date