The first weblog devoted to Demoniak3D Demo-System


November 18th, 2007 Posted in 2D, Programming, Texture, Utility

If you like Hyperion, then you like graphics and programming, and you’ll like ImageMagick too. The best way to describe this fantastic free tool is “programmable Photoshop” : you can create, manipulate and process 2D images with all the powerful functions of an advanced graphics package, but with code lines instead of a GUI and a mouse.

ImageMagick can be used from many languages such as Python or C++, alas not yet LUA, and, of course, from a DOS batch file. This makes it very interesting to automates some operations on textures, or to create graphics for HUDs like in the examples below:

This simple batch creates buttons images with each of the 7 words in the “items” list :

set items=Home Previous Next First Last Help About
set params=-fill black -font c:\windows\fonts\verdanab.ttf
rem Create blank rounded button, as a base for all the others:
convert -depth 8 -size 90x18 -frame 3X3+3+0 -blur 1x1 xc:silver blank.png
for %%a in (%items%) do
    convert %params% -draw "text 8,16 %%a" blank.png %%a.png
for %%a in (%items%) do convert -gamma 1.5 %%a.png %%a_h.png
for %%a in (%items%) do convert -roll +1+1 %%a.png %%a_c.png

Three .png files are created for each button, one in “normal” state, one highlighted for mouse over, and one when clicked :

about.png about_h.png about_c.png

Here they look very basic, but with more code you can do just anything you want : check here to have an idea of what’s possible to do with ImageMagick

In a forthcoming article on HUDs, I’ll show a complete User Interface on Hyperion, with sophisticated graphics created with ImageMagick, and object oriented LUA code to handle it.

Stay tuned !

  1. 2 Responses to “ImageMagick”

  2. By JeGX on Nov 18, 2007

    Nice find! There is also a C api! Hyperion will like it.

  3. By Dr. Goulu on Dec 8, 2007

    I found how to use ImageMagick from within LUA, therfore from within Hyperion : simply use the os.execute function to launch ImageMagick !

    I’ll show an example very soon

You must be logged in to post a comment.