XMagick - Integrate ImageMagick with any X Application
ImageMagick is a robust collection of
tools and libraries to read, write, and manipulate an image in
any of the more popular image formats including GIF, JPEG, PNG, PDF,
and Photo CD. With ImageMagick you can
create GIFs dynamically making it suitable for Web applications.
XMagick is a library written in C, which allows integration of the
ImageMagick library with any X application by providing functions
which convert between the native X image format (XImage) and the
native ImageMagick format (Image).
Status
#!/bin/sh
# If the file oldnews.shtml is present, it will contain a list of
# all the release notes. In that case we only need to list the most
# recent one here.
oldnews()
{
f=`echo $news|cut -f 1 -d ' '`
s=`basename $f .shtml | cut -c 6-`
echo "News in $s"
echo ""
echo "Old news"
echo " "
exit
}
test -n "$QUERY_STRING" || exit
dir=/var/www/vhosts/"$QUERY_STRING"
cd "$dir" || exit
echo "Content-type: text/html"
echo
news=`ls -t news-*.shtml`
c1="#99ccff"
c2="#ffffff"
bgcolor="$c1"
test -f oldnews.shtml && oldnews
echo " "
for f in $news; do
s=`basename $f .shtml | cut -c 6-`
echo ""
echo "News in $s"
echo " | "
if test "$bgcolor" = "$c1"; then
bgcolor="$c2"
else
bgcolor="$c1"
fi
done
echo " "
Version 0.0.1 caches results from XAllocColor and XQueryColor,
speeding things up dramatically. Autoconfiguration of shared
and static versions of the library. New Magick widget and demo program.
Version 0.0.2 adds autoconfiguration for the example programs.
Version 0.0.3 further optimizes the colour cache, speeding up
lookups and making XMagickImageToXImage faster. See
ChangeLog for details.
Version 0.0.4 makes a linear search for a best match if XAllocColor
fails. It also adds manpages for the library and functions.
Version 0.1.0 is updated to support ImageMagick 5.2.0.
Version 0.2.0 is updated for ImageMagick 5.5.0. It is also
much faster.
This code has been tested on Linux and Solaris. Reports of success
or failure on other systems are welcome.
Examples
These two examples are included with the library, but not built by default.
A Widget
demo.c
Magick.c
Magick.h
MagickP.h
This program displays an image in a custom widget. The name of the
image to display is given on the command line.
Basic Conversion
demo2.c
This program reads an image, converts the Image to an
XImage and back, and stores the result. It can be used to convert
between any formats supported by ImageMagick.
Links
Download
ImageMagick homepage
ImageMagick Integration Project
Freshmeat project page
More stuff
#!/bin/sh
echo "Content-type: text/html"
echo
echo ""
Ulric Eriksson - January 2004 - ulric@siag.nu
|