Do You Believe in Magick?
Sooner or later, virtually every app needs to do some on-the-fly image processing. You know, those annoying chores that you could theoretically do by hand in Adobe Photoshop or other equivalent app: Scale an input file so it will look nice on the web, recompress a set of JPEGs that is just too fat, or convert from some obscure file format to TIFF or PNG. When it's time to do real image processing, get a really useful library like GraphicsMagick to do the work for you.
GraphicsMagick aims to provide one-stop-shopping with a robust collection of tools and libraries that support reading, writing, and manipulating an image in over 88 major formats, including important formats such as DPX, GIF, JPEG, JPEG-2000, PNG, PDF, SVG, and TIFF. GraphicsMagick supports huge images on systems that support files over 2GB and images well into the gigapixel range. GraphicsMagick can create new images from scratch or take an existing image and resize, rotate, sharpen, color reduce, or add special effects. When you're done, it will save it out to any supported format. GraphicsMagick is accessible from C/C++, Perl, Tcl, Ruby, or .NET interfaces. If you're a batchfile wiz, you can set up most operations thru the command line interface on any version of Windows or Unix.
If GraphicsMagick sounds vaguely familiar, you may have seen its ancestor ImageMagick 5.5.2. The good news is that GraphicsMagick is available free for use in both open and proprietary applications, and may be redistributed without fee. Its X11-style ("MIT") license is approved by the Open Source Initiative and declared by the FSF to be compatible with the GPL Version 2.
I could probably spend all day enumerating the features, but here's the short list that I call the "top ten reasons to use GraphicsMagick":
- Convert an image from one format to another (for example, from TIFF to JPEG)
- Resize, rotate, sharpen, color reduce, or add special effects to an image
- Create a montage of image thumbnails
- Deep pixel support with 24-bit, 32-bit, 48-bit, and 64-bit color images
- Turn a group of images into a GIF animation sequence
- Create a composite image by combining several separate images
- Draw shapes or text on an image
- Decorate an image with a border or frame
- Describe the format and characteristics of an image
- Best TIFF variant support in the industry
Getting Started with GraphicsMagick
GraphicsMagick lets you choose your own level of integration for C/C++ developers: both static library and DLL (import library) options are readily available at the Windows binary FTP site. Additionally, you can choose pre-compiled binaries for 24-bit/32-bit color or 48-bit/64-bit color support. If you're not doing scientific, medical, or cinematic image processing, you'll find the 24-bit/32-bit color is plenty good enough. The precompiled binaries don't contain any source code, programming API documentation, or header files, so be sure to pick up the full source ZIP as well and unzip it somewhere handy.
GraphicsMagick for Windows v1.2.5 has a professional installer with options to associate file extensions, install the Perl modules for ActiveState Perl, and the GraphicsMagickObject OLE control for .NET access thru VBscript, VB, WSH, and other scripting systems. If you are using any of these non-C/C++ interfaces, you can skip downloading the source tree unless you are curious.
Before you can use ImageMagic with C/C++ , you will need to rebuild the configure.exe program that builds the magick_config.h file. This file provides specific information on what packages are integrated with your VisualMagick system as well as handling anything specific to which version of Visual Studio that you are going to be using. Windows users will want to leave in support for all optional modules, I think (for example, PNG file support, and so forth).
The configure.exe file also produces a Solution (.SLN) file for building GraphicsMagick using the style of library that you specifically want: static library, dynamic library, and threading options. Unfortunately, configure.exe crashed when I ran it but I was able to comment out a debugging "cout" and then it finished making the SLN files.
Figure 1: Configuring GraphicsMagick for the build you want to use
Then of course, you need to actually build the actual demo program.