An SWI-Prolog interface to ImageMagick.
plimk is a prolog interface to the ImageMagick graphics manipulation library.
From ImageMagick website: ImageMagick™ is a robust collection of tools and libraries to read, write, and manipulate an image in many image formats (over 90 major formats) including popular formats like TIFF, JPEG, PNG, PDF, PhotoCD, and GIF. With ImageMagick you can create images dynamically, making it suitable for Web applications. You can also resize, rotate, sharpen, color reduce, or add special effects to an image or image sequence and save your completed work in the same or differing image format.
plimk is distributed under the GNU Lesser General Public License.
At this moment plimk is only tested on Linux, although I hope it would work on other Unix systems too. About Windows, well... patches are welcome!!!
plimk uses autoconf for automatic configuration.
As a first step, ensure that both SWI-Prolog plld
and ImageMagick Wand-config
utilities are on your
PATH
.
then extract the plink archive...
$ tar xzf plimk-0.01 $ cd plimk-0.01
...and run...
$ ./configure $ make $ make install
...and it's done!
plimk is generated with the help of pwig (another one of my free software projects :-). But don't worry about that, you will need pwig only if you want to change something inside plimk itself.
There is not any specific documentation for plimk but it is a direct mapping of the MagickWand C API so read the documentation there.
Just remember some simple rules about how C functions are wrapped on prolog:
NewMagickWand
becomes new_magick_wand
.
MagickWand *NewMagickWand()
becomes new_magick_wand/1
...
double
arguments will accept "is-evaluable" arithmetic expressions on the prolog
side, i.e. draw_rectangle(D, X0, Y0, X0+DX, Y0+DY)
.
garbage_collect_atoms/0
from time to time on your code.
This is beta quality software, expect bugs, although not too many.
Send bug reports to this address.
Known bugs:
enum
values used as flags that can be combined are not supported
yet (i.e, enum { foo=0x1, bar=0x2, doz=0x4, moc=0x10, pot=0x20 }
).
On the distribution, on the samples directory, you will find
hanoi.pl
, a prolog program able to solve the
classical "Towers of Hanoi" problem creating an animation with the
solution.
run it as...
?- ['samples/hanoi']. % library(plimk) compiled into plimk 0.09 sec, 250,620 bytes % samples/hanoi compiled 0.09 sec, 260,076 bytes Yes ?- hanoi([red, green, yellow, purple, gray]).
the animation will show!