Notebook / Archives

The Making-Of a Blog: adding a photo-like border to your images

« I need to work on my stylesheet / \ The Making-Of a Blog: dropping shadows »

April 29, 2003

The Making-Of a Blog: adding a photo-like border to your images

After reading this entry from Paolo Valdemarin about Food blogging (more info here in a previous entry) and watching the beautiful photo effect, I wanted to do the same thing.

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):


  1. resize the original image to get a width of 200 pixels;

  2. add a white border of 4 pixels;

  3. add a black border of 1 pixel;

  4. rotate the image by -5 degrees.


Here is my MSL file:

<?xml version="1.0" encoding="UTF-8"?>
<image>
<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" />
</image>

You can interpret this doeffect_photo.msl XML script and see the result on Windows using IMDisplay with the following batch file:

@echo off
conjure -f %1 doeffect_photo.msl
imdisplay %1_photo.jpg

My result:

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 convert and 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.

Posted by Jean-Philippe on April 29, 2003 at 04:39 AM 31 Comments, 1135 TrackBacks

Filed in ImageMagick, making-of, my website

Post your own.

Comments

26

fmgeukfbo.qijmjqqf, http://www.lkhuwtolnm.com/ brdveudrmg

Posted by lnmuvfqihu on August 12, 2013 at 11:34 AM (Spam: 50%)

30

rzovokfbo.qijmjqqf, http://www.hrsxjpfolg.com/ tvdpfwhrru

Posted by rynaifamir on June 27, 2014 at 08:16 AM (Spam: 50%)

Post a comment
Security Code Check





Remember personal info?


Entries by category

Entries by month