0

ImageMagick align images

convert 0000.png -background "#ffffff" -gravity south -splice 0x32 blank0000.png
convert -pointsize 24 -gravity south -annotate 0 "0" -fill red blank0000.png text0000.png
montage text0000.png text0001.png text0002.png text0003.png text0004.png text0005.png text0006.png text0007.png text0008.png text0009.png text0010.png text0011.png text-geometry +4+3 montage0.png
0

Magick++: Draw a circle

Magick++ provides a sub-class DrawableCircle that draws a circle on an image canvas. We should note the crazy design of the class.

The sub-class is called as
image.draw( DrawableCircle(originX_, originY_, perimX_, perimY_) );
This call draw a circle, center of it is located at (originX_, originY_) and its radius is sqrt( (originX-perimX_)^2+originY-perimY_)^2 ). If you would like to draw a circle of 5 pixels radius at (100,50), you should call
image.draw( DrawableCircle(100, 50, 100+5, 50) );

0

Magick++ (ImageMagick C++ API) install

Installation of Magick++ that is C++ API of ImageMagick.
I installed ImageMagick version 6.7.7-3 with Visual Studio 2008 under Windows7 64bit.

1. Download the source files
ImageMagick web
Go to Download page from left side bar and go to a mirror server. Then, download windows -> ImageMagick-windows.zip or ImageMagick-windows.7z

2. Compile
Let DIR_ROOT denotes a root directory of unpacked file. In DIR_ROOT, there is a file, named Install-windows.txt, describing a procedure of installation. Basically, you can install Magick++ by following the file.

This step is done in a directory DIR_ROOT\VisualMagick.

2.1. Configure
First step is to configure the Visual Studio workspaces for ImageMagick. ImageMagick provides 2 ways for this configuration: using a pre-built .exe file and using an own-built .exe file.
1) Configure from pre-built .exe file
Go to DIR_ROOT\VisualMagick\configure and run configure.exe. By following the UI, Visual Studio .sln file is generated in DIR_ROOT\VisualMagick. Install-windows.txt provides further detail about options of configure.exe.

2) Configure from own-built .exe file
If the above .exe file does not work or you want to configure from scratch, you can choose this way.
Open configure.sln in DIR_ROOT\VisualMagick\configure and build it in Release mode. The .sln file outputs configure.exe. Then, run the .exe file. Same as the above way, Visual Studio .sln file is generated in DIR_ROOT\VisualMagick.

2.2. Compile
Now, you have one of the following .sln files
– VisualDynamicMT.sln, ifDynamic Multi-threaded DLL runtimes
– VisualStaticST.sln, if Static Single-threaded runtimes
– VisualStaticMT.sln, if Static Multi-threaded runtimes
– VisualStaticMTDLL.sln, if Static Multi-threaded DLL runtimes
Open the .sln file and build the .sln file in desired configuration (Debug, Release, or both Debug and Release).
1. Right click on the All project and select Set As Active Project
2. Select “Build=>Clean Solution”
3. Select “Build=>Build Solution”

After the compilation, important files are located in the following directories.
– DIR_ROOT\ViauslMagick\bin: .exe, .dll, .imc, and .xml files
– DIR_ROOT\VisualMagick\lib: .lib files
– DIR_ROOT\magick: .h files
– DIR_ROOT\Magick++\lib: .h files
– DIR_ROOT\wand: .h files

2.3. Make own code with Magick++
Same as any libraries,
– Include necessary .h files.
– Specify necessary .lib files.
– Set a path to a directory in which .dll files are located.