PHP comes with the GD graphics library bundled making for a ready to use graphics tool. However, web developers have demanded more quality and performance that GD has traditionally been able to provide. Several attempts were made at providing Image Magick support for PHP, until Mikko Koppanen set to the task to provide a comprehensive extension called Imagick which provides a feature rich object oriented interface to the Image Magick library. The Imagick extension can be compiled directly into PHP or as a shared library.
|Published (Last):||28 April 2016|
|PDF File Size:||4.47 Mb|
|ePub File Size:||10.59 Mb|
|Price:||Free* [*Free Regsitration Required]|
Jump to navigation. In a recent article about lightweight image viewers , author Scott Nesbitt mentioned display, one of the components in ImageMagick. ImageMagick is not merely an image viewer—it offers a large number of utilities and options for image editing. For one thing, it is rock-solid dependable. But an even bigger benefit is that it allows you to set up methods to edit a large number of images in a particular way. Let's start with the command Scott mentioned: display. Say you have a directory with a lot of images you want to look at.
Start display with the following command:. This will load your JPG files sequentially in alphanumeric order, one at a time in a simple window.
Although display 's GUI interface provides a reasonably competent image editor, ImageMagick also provides 89 command-line options, many of which correspond to the menu items above. For example, if I'm displaying a directory of digital images that are larger than my screen size, rather than resizing them individually after they appear on my screen, I can specify:. Many of the operations in the menus above can also be done by adding an option in the command line. For example, try these out:.
These operations create interesting images. Try enhancing colors or making other edits after reducing colors. Remember, unless you save and overwrite them, the original files remain unchanged. The convert command has options—yes —that provide a wide range of things you can do some of which display can also do. I'll only cover a few of them, mostly sticking with image manipulation.
The second would do this operation on all the BMP images in a directory. Let's pick through a few interesting ways we can use the convert command to manipulate images. Here is the general format for this command:.
You can have multiple options, and they are done in the order they are arranged, from left to right. In my experience, it needs to be a small number even less than 1 to achieve something that resembles a charcoal drawing, otherwise you get pretty heavy blobs of black.
Even so, the sharp edges in an image are quite distinct, unlike in a charcoal drawing. The original image is in the upper left. In the second command the lower-left image , we have reduced the number of colors to four, which doesn't look much different from the original.
But look what happens when we combine these two in the third command lower-right image! Perhaps it's a bit garish, but who would have expected this result from the original image or either option on its own? This is another kind of edge detector, called a "multi-stage algorithm.
It's a bit minimalist, but I think it resembles a pen-and-ink drawing, a rather remarkable difference from the original photos. It doesn't work well with all images; generally, it works best with images with sharp lines. Elements that are out of focus are likely to disappear; notice how the background sandbar in the egret picture doesn't show up because it is blurred.
Also notice in the ship picture, while most edges show up very well, without colors we lose the gestalt of the picture, so perhaps this could be the basis for some digital coloration or even coloring after printing.
Finally, I want to talk about the montage command. I've already shown examples of it above, where I have combined single images into composites. You can place all the image names at the end, with the last image name the file where the montage is saved.
This might be useful to create an alias for the command and all its options, then I can simply type the alias followed by the appropriate filenames. I've done this on occasion to reduce the typing needed to create a series of montages. There is a lot more to learn about ImageMagick, so I plan to write more about it, maybe even about using Perl to script ImageMagick commands.
This stuff can also be used on the server side. Have you ever heard of the upside-down Internet? Learn common ways to view and modify images with this lightweight image editor. Image by :. Get the highlights in your inbox every week. This introduction to common ImageMagick commands should get you started. The display command Let's start with the command Scott mentioned: display.
Topics Art and design. Getting started. About the author. Greg Pittman - Greg is a retired neurologist in Louisville, Kentucky, with a long-standing interest in computers and programming, beginning with Fortran IV in the s. When Linux and open source software came along, it kindled a commitment to learning more, and eventually contributing.
He is a member of the Scribus Team. More about me. How to whiteboard collaboratively with Drawpile. Scott Nesbitt on 21 Aug Permalink. A nice overview and refresher. Roland on 21 Aug Permalink. Greg Pittman on 22 Aug Permalink. That's very interesting. I guess a broader concept of image viewer might include browsers. Roland on 28 Aug Permalink. I had such a complete tools installed but did not know of it potential Good to know, thanks!
This lightweight image editor has many functions. I plan to start working with ImageMagick. Sachin Patil on 22 Sep Permalink. Great post Greg. I'm glad that we have a post on Imagemagick now. Share your sysadmin tricks Send us home-grown sysadmin scripts. Submit an article proposal today. Learn more.
How to get started with the ImageMagick image editor