Welcome, Guest! Log In | Create Account

Main Page

From cgiscaler

Jump to: navigation, search

File:Logo.png

Welcome to the CGIScaler project page.

CGIScaler is a small and fast, ImageMagick® based CGI image scaler for any web based application requiring intensive thumbnailing.

The main goal of this project is to create a robust and high-performance image scaler useful for any web application that operates on digital image media. It is currently used on multiple production systems and generates thousands of thumbnails every day.

Contents

Theory of operation

This program utilises ImageMagick® for image access and manipulation. For each request a CGI process is spawned. Firstly, CGIScaler will check if original and cached versions of the requested thumbnail exist. If the original does not exist, cached image will be removed and an error image will be sent. If cached thumbnail exists and it has the same time stamp as the original file, the cached thumbnail will be immediately sent and no ImageMagick® library initialization will happen. If a cached thumbnail timestamp is older than the timestamp of the original image, the cached thumbnail will be deleted. If cached thumbnail does not exist (or was just deleted), ImageMagick® will be initialized and a scaled down version of the original image will be created. CGIScaler will do fast pre-scaling or load a smaller sub image (in case of JPEG) before performing the high quality scale-down. To further improve timing CGIScaler will sent scaled down image to the client before writing it to disc cache. After image was sent to client it is saved in a cache directory by replicating the sub directory structure and with use of a file name in the following format: '<original_file_name_with_extension>-<width>-<height>-<strict>-<quality>.<output_extension>'. In case of any error that would happen before the thumbnail was sent to the client an error image will be sent instead.

Scaling modes

Currently two modes are supported:

Fit

Image will be scaled to fit required dimensions without loosing the aspect ratio. In this mode one of the resulting image dimensions may be smaller than requested.

Image:Fit.jpg

Strict

In strict mode image will be cropped and scaled to fill the required dimensions.

Image:Strict.jpg

Configuration

For configuration parameters see ./cgiscaler --help or see the installation INSTALL file included in the release.

Performance

Performance tests show that CGIScaler is capable of delivering 39.7 thumbnails per second with an empty cache and 126.2 per second when all thumbnails are cached on a virtual server with only one VCPU (Xen).

For more details see the PERFORMANCE file included in the release.