The Making-Of a Blog: adding a photo-like border to your images
I tried to mimic the effect with the command line tools
conjure from ImageMagick (a collection of tools and libraries to manipulate images) which can process a Magick Scripting Language (MSL) file –
conjure is useful to accomplish custom image processing tasks without using PerlMagick for example (PerlMagick is the Perl binding to ImageMagick). Apart ImageMagick, you will need the XML parser which comes with Libxml2 (The XML C library for Gnome); you can find the Windows port on Igor Zlatkovic's website (on the page where you can download binaries, do not forget to get iConv if you do not want to be reminded by
conjure that you lack a library). After theses downloads, you must modify the path to point to the two new libraries.
To accomplish this effect, I wanted to take a JPEG file
f.jpg to get another JPEG file
f_photo.jpg (without needing to add the file extension):
- resize the original image to get a width of 200 pixels;
- add a white border of 4 pixels;
- add a black border of 1 pixel;
- rotate the image by -5 degrees.
Here is my MSL file:
<?xml version="1.0" encoding="UTF-8"?>
<read filename="%[f].jpg" />
<resize geometry="200x" />
<border fill="white" width="4" height="4" />
<border fill="black" width="1" height="1" />
<rotate degrees="-5" />
<write filename="%[f]_photo.jpg" />
You can interpret this
doeffect_photo.mslXML script and see the result on Windows using
IMDisplaywith the following batch file:
conjure -f %1 doeffect_photo.msl
As you can see, I have two main problems. First, the image is aliased and it seems you cannot script an antialiasing inside a MSL file (and I have many problems today with
convertand as always with
mogrify– the first reason I am using an MSL script is that I do not succeed using these tools :( ). Secondly, I absolutely do not know how to make this shadow effect which gives a relief to the image.
I have to explore further. But I think it could be easier with the Perl binding.