Imgserv
This page is obsolete. It is being retained for archival purposes. It may document extensions or features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date. |
imgserv is a Java-based, network-accessible image scaling and transcoding server. It can:
- Resize images
- Resize very large PNGs using a constant amount of memory
- Transcode images (e.g. convert GIFs to PNGs)
- Rasterize SVGs
Download the latest release from tools.wikimedia.de.
Installing the server
Extract the archive and run bin/run.sh to start imgserv:
$ gzip -dc imgserv-server-5.tar.gz | tar xf -
$ cd imgserv-server-5
$ bin/run.sh
You can configure some parts of imgserv in a configuration file; copy imgserv.conf.example to imgserv.conf and start imgserv like this:
$ bin/run.sh -c imgserv.conf
imgserv will automatically support transcoding and standard resizing. See below to enable pngds for constant-memory PNG resizing.
Installing the client
Download the latest client from tools.wikimedia.de. Edit Makefile
if necessary and type make
to compile it. Install imgserv and imgserv-wrapper in a convenient directory (you will probably need to edit imgserv-wrapper to fix the path).
To use imgserv for SVGs, add this to your LocalSettings.php :
$wgSVGConverter = 'imgserv';
$wgSVGConverterPath = '/usr/local/bin';
And for bitmap scaling:
$wgUseImageMagick = false;
$wgCustomConvertCommand = "/usr/local/bin/imgserv-wrapper -w %w -h %h %s %d >/dev/null 2>&1";
Enabling pngds
pngds is a library that allows fast resizing of very large PNG images without large memory usage. To enable pngds support in imgserv:
- Download the current pngds from tools.wikimedia.de.
- cd to pngds/jni/ and run:
make JAVA=<path to Java installation> <target>
<target> should be one of these options: solaris, solaris-gcc, linux.
- Copy libpngds.so to a convenient location (e.g. /usr/local/lib).
- Add this to imgserv.conf:
pngds=yes
tmpdir=/tmp
imgserv will now use pngds to resize PNGs.