NSLU2-Linux
view · edit · print · history

InstallImageMagick, use convert to insert text

The application was to insert text into an already existing JPG image.
The image did come from an USB webcam Logitech E3500. To do that under Ubuntu 0810 was no problem, everything was already installed.
Under SlugOS it was some more work.
Back to HowTo

Install ImageMagick

 
 $ ipkg-opt update
 $ ipkg-opt install imagemagick
 $ ipkg-opt install ghostscript
 $ ipkg-opt install ttf-bitstream-vera
 $ ipkg install libcairo2

I found no way to tell linux where the fonts are located.
Hence you have to tell the font path to the program convert.
For convenience I copied the font Vera.ttf from
/opt/share/fonts/bitstream-vera/Vera.ttf to the application folder.

Example

 
 convert -font Vera.ttf -pointsize 20 -fill red -draw "text 20, 230 '`date`'" source.jpg  target.jpg

The file source.jpg had 320x240 pixel. The size of the font was given with 20pt.
The goal was to give the image a time stamp. Position X=20, Y=230.
I will mention that the convertion took 9 s on a 266 MHz NSLU2. so be careful not to stress the CPU too much.

Please see the attached image how it looks like.

view · edit · print · history · Last edited by RudolfReuter.
Originally by RudolfReuter.
Page last modified on January 14, 2009, at 09:47 AM