Basically, the rescaling algorithm tries to find out which parts of the image are important, and which are not, based on the contrast between adjacent pixels; then, the image is resized through the elimination or insertion of continuous paths, called `seams'. The seams connect the top of the image with the bottom when rescaling horizontally, or they connect the left side with the right side when rescaling vertically. In the seam carving process, seams are removed in sequence, therefore shrinking the image by one pixel at a time. The seam insertion process mirrors the seam carving process, introducing interpolated seams in regions where they would have been carved.
Once it has been computed, the carving information can be efficiently stored in a so called multi-sized image, which can be used to reproduce the carving operation on the fly at any later moment.
It often happens that the automatic feature detection fails to identify as significant some image regions; in these cases a preservation mask can be specified, which marks those regions. In fact, the feature recognition process can be manually driven quite easily to its full extent, by using custom masks.
See also the References section for more information about the algorithm.
As mentioneed above, the enlargment process mirrors the carving process. More precisely, in order to enlarge the image by a given amount of pixels, say N, the library first computes which would be the first N seams to be removed; then, it inserts N new seams nearby those.
This means that it is clearly not possible to go beyond twice the original size in a single step. It also means that doubling the image size in this way is just equivalent to standard scaling, since the result is that each seam is just duplicated. For these reasons, the library rescaling engine automatically divides enlarging sessions in steps, and allows to set the step size.
This same issue also affects in a tricky way the preservation of image areas when enlarging: suppose your image is 1000 pixels wide, and you have protected an area which is 800 pixels wide. It is then clear that you cannot shrink the image to less than 800 pixels without affecting the preserved area, but the same is true when enlarging, so you should not go beyond 1200 pixels in a single step (= 1000 + (1000 - 800)), i.e. you should use a value lower than 1.2 for the enlargement step size.
In general, however, the optimal enlargement step size depends on the image, since large step sizes have the disadvantages discussed above, while small step sizes will tend to inflate the same areas of the image over and over at each step.