iipsrv is an advanced high-performance feature-rich image server for web-based streamed viewing and zooming of ultra high-resolution images.
Switch branches/tags
Clone or download
Pull request Compare This branch is 1 commit ahead, 243 commits behind ruven:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


       IIPImage - High Resolution Streaming Imaging Server

IIPImage is an advanced high-performance feature-rich imaging server system for web-based streamed viewing and zooming of ultra high-resolution 
images. It is designed to be fast and bandwidth-efficient with low processor and memory requirements. The system can comfortably handle gigapixel size images as 
well as advanced image features such as both 8 and 16 bit depths, CIELAB colorimetric images and scientific imagery such as multispectral images, image sequences and 3D surface topologies.

* Fast lightweight embeddable FastCGI server module
* High performance with inbuilt configurable cache
* Support for gigapixel images
* Dynamic JPEG export of whole or regions of images at any resolution
* 8, 16 and 32 bit image support
* CIELAB support with automatic CIELAB->sRGB colour space conversion
* JPEG2000 support
* Supports Zoomify and DeepZoom protocols
* Multispectral image support
* Dynamic watermarking
* Memcached support
* 3D panoramic views 
* Dynamic hillshading of 3D surface topologies
* Dynamic decoder module capability

Detailed class descriptions (generated using doxygen) are available in the
doc subdirectory

iipsrv is released under the GNU General Public License (GPL). See the copyright
notice COPYING in this directory for licensing details or go to
http://www.gnu.org/licenses/gpl.html for more details.

If you use IIPImage on a public site and remove the IIP link logo from the 
client, you must provide a link on your site back to the IIPImage site - 

This distribution includes version 2.4.0 of the FCGI development libraries.
See COPYING.FCGI for licensing information for these libraries.

Requirements: libtiff, zlib and the IJG JPEG development libraries.
Optional: libmemcached (for Memcached) and Kakadu (for JPEG2000)

Plus, of course, an fcgi-enabled web server. The server has been successfully
tested on the following servers:
Apache (http://httpd.apache.org),
Lighttpd (http://www.lighttpd.net)
IIS (http://www.iis.net)
MyServer (http://www.myserverproject.net)

Example server configurations are shown below.

The standard autoconf build process should work fine. If you want to allow
dynamic loading of 3rd party image decoders, use the configure option
--enable-modules. There is a version of the FCGI development library included
in this distribution. The configure script will use this bundled version
unless it detects one already installed. Alternatively, you may specify the
path using --with-fcgi-incl=<path> and --with-fcgi-lib=<path>.

If this is an SVN or Git development version, first generate the autoconfigure
environment using autogen.sh:

Otherwise for release versions, use configure directly:


IIPImage is able to use Memcached (http://www.memcached.org), a high-performance,
distributed memory object caching system. If enabled, IIPImage will cache
results using Memcached, giving IIPImage added speed and scalability. To use
this, you will need to install the library (and development files) of
libmemcached (http://libmemcached.org). This will be automatically detected
during the build process. 

IIPImage is able to decode JPEG2000 images via the Kakadu SDK
(http://www.kakadusoftware.com). This is, however, not open source and will
need to purchase a license for the source code. In order to use, first build
the Kakadu SDK as per the instructions supplied with the SDK. Then, the
following parameters to the ./configure command

Simply copy the executable called iipsrv.fcgi in the src subdirectory into
the web server fcgi directory. If one does not exist, simply create one, called,
for example, fcgi-bin. The web server will need to be configured to use this

There are several startup variables that can be passed to the server.
They are all optional.

LOGFILE: the server will log its output to the file specified, if it can.

VERBOSITY: 0 means no logging, 1 is minimal logging, 2 lots of debugging stuff,
3 even more debugging stuff and 10 a very large amount indeed ;-)

MAX_IMAGE_CACHE_SIZE: Max image cache size to be held in RAM in MB. This is
a cache of the compressed JPEG image tiles requested by the client.
The default is 10MB.

FILESYSTEM_PREFIX: This is a prefix automatically added by the server to the 
beginning of each file system path. This can be useful for security reasons to 
limit access to certain sub-directories. For example, with a prefix of 
"/home/images/" set on the server, a request by a client for "image.tif" will 
point to the path "/home/images/image.tif".  Any reverse directory path 
component such as ../ is also filtered out. No default value.

JPEG_QUALITY: The default JPEG quality factor for compression when the
client does not specify one . The value should be between 1 (highest level of
compression) and 100 (highest image quality). The default is 75.

MAX_CVT: Limits the maximum image dimensions in pixels (the WID or HEI 
commands) allowable for dynamic JPEG export via the CVT command. This 
prevents huge requests from overloading the server. The default is 5000.

MAX_LAYERS: The maximum number of quality layers to decode for images that support 
progressive quality encoding, such as JPEG2000. Ignored for other file 
formats. If not set, half of the available quality layers will be decoded by default.
If set to -1, all the available layers will be decoded by default.

FILENAME_PATTERN: Pattern that follows the name stem for a 3D or multispectral 
sequence. eg: "_pyr_" for FZ1_pyr_000_090.tif. The default is "_pyr_". This is 
only relevent to 3D image sequences.

WATERMARK: TIFF image to use as watermark file. This image should be not be 
bigger the tile size used for TIFF tiling. If bigger, it will simply be 
cropped to the tile size. If smaller, the watermark will be positioned 
randomly within the available space. The image can be either colour or 

WATERMARK_PROBABILITY: The probability that a particilar tile will have a watermark
applied to it. 0 means never, 1 means always.

WATERMARK_OPACITY: The opacity (between 0 and 1) applied to the watermark image.

MEMCACHED_SERVERS: A comma-delimitted list of memcached servers with optional
port numbers. For example: localhost,,

MEMCACHED_TIMEOUT: Time in seconds that cache remains fresh.
Default is 86400 seconds (24 hours).

INTERPOLATION: Interpolation method to use for rescaling when using image export.
Integer value. 0 for fastest nearest neighbour interpolation. 1 for bilinear
interpolation (better quality but about 2.5x slower). Bilinear by default.

DECODER_MODULES: Comma separated list of external modules for decoding 
other image formats. This is only necessary if you have activated 
--enable-modules for ./configure and written your own image format 

The images paths given to the server via the FIF variable must be
absolute paths on the server machine (eg. FIF=/images/test.tif) 
and not paths relative to the web server document root location.
Images do not, therefore, need to be directly accessible by the
client via the web server. Make sure the server process owner is
able to access and read the images!


Apache and mod_fastcgi:
httpd.conf example extract:

# Create a directory for the iipsrv binary
ScriptAlias /fcgi-bin/ "/usr/local/httpd/fcgi-bin/"

# Set the options on that directory
<Directory "/usr/local/httpd/fcgi-bin">
   AllowOverride None
   Options None
   Order allow,deny
   Allow from all

# Set the module handler
AddHandler fastcgi-script fcg fcgi fpl

# Initialise some variables for the FCGI server
FastCgiServer /usr/local/httpd/fcgi-bin/iipsrv.fcgi \
-initial-env LOGFILE=/tmp/iipsrv.log \
-initial-env VERBOSITY=2 \
-initial-env MAX_IMAGE_CACHE_SIZE=10 \
-initial-env FILENAME_PATTERN=_pyr_ \
-initial-env JPEG_QUALITY=50 \
-initial-env MAX_CVT=3000

Apache and mod_fcgid:

mod_fcgid is a binary compatible replacement for mod_fastcgi. It works in the 
same way, but is configured differently. Load the module like this:

LoadModule fcgid_module /path/to/apachemodules/mod_fcgid.so

Here is an example configuration. Note that mod_fcgid does not have a 
FastCgiServer directive and there is no need to explicitly start the server:

# Create a directory for the iipsrv binary
ScriptAlias /fcgi-bin/ "/var/www/localhost/fcgi-bin/"

# Set the options on that directory
<Directory "/var/www/localhost/fcgi-bin/">
   AllowOverride None
   Options None
   Order allow,deny
   Allow from all

   # Set the module handler
   AddHandler fcgid-script .fcgi

# Set our environment variables for the IIP server
FcgidInitialEnv VERBOSITY "5"
FcgidInitialEnv LOGFILE "/tmp/iipsrv.log"
FcgidInitialEnv MAX_IMAGE_CACHE_SIZE "10"
FcgidInitialEnv JPEG_QUALITY "50"
FcgidInitialEnv MAX_CVT "3000"

# Define the idle timeout as unlimited and the number of
# processes we want
FcgidIdleTimeout 0
FcgidMaxProcessesPerClass 1


Note that on CentOS, FcgidIPCDir is configured by default to 
/var/log/httpd/fcgidsock, which may not be writable by Apache. If this is the case, 
specify another location for FcgidIPCDir, which is writable, such as /tmp/fcgidsock

lighttpd.conf example extract:

fastcgi.server = ( "/fcgi-bin/iipsrv.fcgi" =>
  (( "host" => "",
     "port" => 9000,
     "check-local" => "disable",
     "min-procs" => 1,
     "max-procs" => 1,
     "bin-path" => "/var/www/localhost/fcgi-bin/iipsrv.fcgi",
     "bin-environment" => (
        "LOGFILE" => "/tmp/iipsrv.log",
        "VERBOSITY" => "5",
        "MAX_IMAGE_CACHE_SIZE" => "10",
        "FILENAME_PATTERN" => "_pyr_",
        "JPEG_QUALITY" => "50",
        "MAX_CVT" => "3000"


iipsrv can also be used with lighttpd's spawn-fcgi without the need for a 
full web server. Simply spawn the iipsrv process on the command line. The 
process can be bound to an IP address and port for backend load-balancing 
configurations. For example:

spawn-fcgi -f src/iipsrv.fcgi -a -p 9000

Simply run the MyServer configuration and in the MIME section, choose the .fcgi extension
and select:

MIME Type: application octet-stream
Action: Execute self contained FastCGI
Manager: NONE 

Java Application Servers (Tomcat, Jetty, JBoss etc)

IIPImage can also be used with Java Application Servers such as Apache Tomcat, JBoss and Jetty. Simply add 
the JFastCGI jar file to your webapp and add the following to your web.xml configuration file in order to 
re-route FCGI requests to the IIPImage server on the specified port.

<!-- Gateway Servlet to IIPImage FCGI server -->



You then need to start an instance of the server on the requested port (6667 in this example) using 
spawn-cgi (see spawn-cgi section above).

Command Line:

It is also possible to start iipsrv on the command line. For example:

iipsrv.fcgi --bind

where the argument given to bind is the socket on which to listen to FCGI
requests. Your web server should, therefore, be configured to use this socket.
For example with lighttpd:

fastcgi.server = (
  "/fcgi-bin/iipsrv.fcgi" => (
        ("host"=>"", "port"=>9000, "check-local"=>"disable")

Please refer to the project site http://iipimage.sf.net for further details
(c) 2000-2013 Ruven Pillay <ruven@users.sourceforge.net>