Overview of the library

The Liquid Rescale library is written in C, but can be used into C++ programs without any modification. It has an object-oriented design, so that the terminology in this manual is borrowed from C++. The central class of the library is called LqrCarver. Carver objects can generate and store multi-size images, or load them, and read them out at the desired size.

Internally, multi-size images are stored simply as plain images with the addition of a visibility map. Each pixel in the image has its own visibility level. Whether to display a pixel or not simply depends on the comparison of each pixel's visibility with a given global visibility level. In this way, images of different sizes can be read out, simply by setting a global visibility level.

Therefore, once the visibility map has been computed, it allows effortless, real-time scaling. However, visibility maps also necessarily have an orientation, either horizontal or vertical. If we want to resize on the other direction, the visibility map has to be computed afresh, and the previous visibility map becomes useless, because the two maps are not consistent one with the other.

This also implies that the resizing order affects the final result: rescaling horizontally first, then vertically, does not yield the same result as following the reverse order. Moreover, one could choose an intermediate way, e.g. by rescaling by one pixel in one direction, one in the other, then iterating as needed to reach the final size.

The default behaviour of the library is to rescale horizontally first, then vertically, but this order can be reversed.

Visibility maps can be stored in objects of type LqrVMap. When an LqrCarver object is created from an input image, the visibility of each pixel is uninitialised. At this point, one could either import a previously computed LqrVMap, or activate the LqrCarver so that it creates one afresh when asked to.

In either case, there's a single method to call, specifiying the new desired size; all the rest will automatically be computed as necessary. By default, the visibility maps are only computed up to the extent to which they are needed for resizing.