Webmagick and Imagemagick are very capable image manipulation utilities. I needed to create a "montage" of thumbnails for a website on a nightly basis. To do this I decided from surveying the user groups that webmagick was the way to go. Indeed, it now works flawlessly. Getting here was a bit of a learning curve (especially for a perl novice.)
To help the rest of my debian brothers, I submit this email to the archives of the webmagick, imagemagick and debian-users mailing lists. This is for Debian Woody. I don't claim this to work or be necessary on other distributions. Debian Woody ships with an older version of Webmagick, Imagemagick and Perlmagick. If you select to load Webmagick, all will install properly and it will be immediately usable. I recommend this for anyone who is doing a one time conversion or is doing just a few files on continual basis. My definition of a few files is less than 300. I was converting 1800+ 15Kbyte files a night and it was taking about 3 hours to run. Also, it was eating 2 Gigabytes of memory and putting the system load at close to 3 (2.6GHz P4 w/ 1 Gig mem and 2 Gig swap). I had a backlog of pictures (about 20,000) so this was not going to work for me. If you decide to Download the latest versions, your reward will be a memory usage of less than 20Megs and a runtime of around 5 minutes. For me, this was an absolute necessity. === Getting the software ==== Webmagick -- http://webmagick.sourceforge.net/ Imagemagick -- http://www.imagemagick.org/ I placed both tars in the /usr/src directory and unpacked them there. === Preparing the system ==== If you started by installing the debian versions first, YOU MUST DO THESE STEPS 1) Remove the packages including removing the configuration files. In dselect, use the '_' instead of the '-' to remove the packages. This removes configuration information as well. The packages to remove are: webmagick, imagemagick, perlmagick and libmagick. 2) Run: find / -name "*agick*" against the system and remove any remnants that may be there including any leftover directory structures. I failed to properly clean my system, and as a result chased some strange errors for several days before doing this level of scrubbing. It seems that Perlmagick will pick up on old files and try to execute things that are no longer there. ==== Preparing to build Imagemagick ==== You are going to need a few packages before you can build Imagemagick Install ghostscript: gsfonts, gs, gs-common Install perl development: libperl-dev Install jpeg support: libjpeg62-dev Install freetype support: libfreetype6-dev Some of these will bring in other packages as well and that is fine. ==== Building Imagemagick ==== Follow the 'INSTALL-unix.txt' instructions in the root of the Imagemagick source directory. These are well written and fairly short. Make the following changes: ./configure --with-gs-font-dir=/usr/share/fonts/type1/gsfonts The path to the ghostscript fonts is incorrect for Debian. So, when you invoke configure you will need to use the command line option to tell it where debian puts the fonts. You're output from configure should look something like this: ------------------------------------------------------------------------ --- Imagemagick is configured as follows. Please verify that this configuration matches your expectations. Host system type : i686-pc-linux-gnu Option Configure option Configured value ----------------------------------------------------------------- Shared libraries --enable-shared=no no Static libraries --enable-static=yes yes GNU ld --with-gnu-ld=yes yes LZW support --enable-lzw=no no Quantum depth --with-quantum-depth=16 16 Delegate Configuration: BZLIB --with-bzlib=yes no DPS --with-dps=yes no EXIF --with-exif=yes no FlashPIX --with-fpx=yes no FreeType 2.0 --with-ttf=yes yes Ghostscript None /usr/bin/gs (6.53) Ghostscript fonts --with-gs-font-dir=/usr/share/fonts/type1/gsfonts /usr/share/fonts/type1/gsfonts/ Ghostscript lib --with-gslib=no no JBIG --with-jbig=yes no JPEG v1 --with-jpeg=yes yes JPEG-2000 --with-jp2=yes no LCMS --with-lcms=yes no Magick++ --with-magick-plus-plus=yes yes PERL --with-perl=yes /usr/bin/perl PNG --with-png=yes no TIFF --with-tiff=yes no Windows fonts --with-windows-font-dir= none WMF --with-wmf=yes no X11 --with-x= no XML --with-xml=yes no ZLIB --with-zlib=yes no X11 Configuration: Not using X11. Options used to compile and link: CC = gcc CFLAGS = -g -O2 -Wall CPPFLAGS = -I/usr/include/freetype2 -D_FILE_OFFSET_BITS=64 -D_REENTRANT CXX = g++ CXXFLAGS = -g -O2 LDFLAGS = -L/usr/lib LIBS = -lfreetype -ljpeg -lpthread -lm ------------------------------------------------------------------------ --- The "Configured value" column is the important one. Make sure that all the yes' and values are in the right place for what your trying to do. As you can see, I did not want PNG support, but you may... make and make install work as advertised. So just run them. Once they are completed, cd to the PerlMagick directory under the ImageMagick directory and run the following commands: perl Makefile.PL make make install make test I have no idea why this is necessary, but without doing this various necessary library files seem to be missing in the installation. The last line is not really necessary, but you should get a descent number of the test to run. I got around 60% of the main test and about 90% of the subtests. Failures are caused by packages not being enabled (like X11 support which webmagick does not need). ==== Testing the installation === Ok, if all this worked (and it should) you should be able to do the following (This is directly from the Imagemagick developers email to me): Before concerning yourself with PerlMagick and WebMagick make sure ImageMagick can read jpegs. Type convert -list format Is JPEG listed: JPEG* JPEG rw- Joint Photographic Experts Group JFIF format (62) JPG* JPEG rw- Joint Photographic Experts Group JFIF format If not, go back to config.log to determine why the configure program failed to accept your JPEG installation. If JPEG is listed, type convert logo: logo.jpg identify logo.jpg If all this works, PerlMagick should be able to read JPEG images. To test, run this script: use Image::Magick; $image=Image::Magick->new(): $x = $image->Read('logo.jpg'); warn "$x" if $x; $x = $image->Write('image.jpg'); warn "$x" if $x; If the above script works, WebMagick should be able to read JPEG images. For Perl newbie's like myself, take the little perl script above and put it into an executable file. Then run it by typing: #perl [NameOfFile] You should get no output, that is, it should run clean without warnings or errors. ==== Building Webmagick === The top part of the INSTALL instructions in the Webmagick source directory talk about configuring ImageMagick. You can skip these steps because you have already carefully performed them above. About half way down the document, you will come to the configure step for Webmagick. My command looked like: ./configure --prefix= /usr/share/apache/webmagick Because I wanted the pictures placed in the area that apache uses for shared components. You will also want to add the following lines to your apache/httpd.conf file: # # Aliases: Add here as many aliases as you need (with no limit). The format is # Alias fakename realname # # Note that if you include a trailing / on fakename then the server will # require it to be present in the URL. So "/icons" isn't aliased in this # example, only "/icons/".. # Alias /webmagick/ /usr/share/apache/webmagick/ <Directory /usr/share/apache/webmagick> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory> Now any virtual servers can get to the webmagick images with http://[yourvirtualdomain]/webmagick/ I forget how I answered all the other questions it asked, but rerunning it works just fine so feel free to experiment. ==== Some final fixes === The current version of Webmagick and Imagemagick (more specifically Perlmagick) are out of sync with each other. It may happen that webmagick ends up using GraphicsMagick's PerlMagick (http://www.graphicsmagick.org/) instead. However, today you would have to do some searching and replacing to make that happen. To get Webmagick working the way we are going, make the following edits to the /bin/webmagick file: Change: $opt_thumbcompose = 'Replace'; # Thumbnail image composition operation To: $opt_thumbcompose = 'Copy'; # Thumbnail image composition operation Comment out: # $montageArguments .= "foreground=>\'$opt_thumbforeground\',\n " # if $opt_thumbforeground ne 'false'; ==== Runing Webmagick === That's all folks! You should be able to run a nice quiet montage now with a command like: webmagick --iconbase ../../../../webmagick Have Fun!!! Keith Goettert, CIO, Lightwave Access, LLC. [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]