Liquid rescaling

The resizing method
Flattening

The resizing method

Once initialized, or if a visibility map has been loaded, the image can be resized through this function:

LqrRetVal lqr_carver_resize( LqrCarver * carver,
  gint new_width,
  gint new_height);
 

This function decides automatically whether it can use the already computed visibility map, it has to update it or waste it completely and start afresh. This last event occurs when the map was computed for horizontal resizing and a vertical resize has been requested, or vice versa, and also when the required enlargment is bigger than the enlargement step value (see Setting the enlargement step). Note that only initialized carvers can update or change the visibility map; if this is not the case, an error is returned.

The function also takes advantage of the fact that the enlargment process mirrors the shrink process. For example, if the original size of the image is (w0, h0) and lqr_carver_resize is invoked with (w0 - 100, h0) as an argument, then subsequent calls to the function will allow on-the-fly resizing in the whole range from (w0 - 100, h0) to (w0 + 100, h0). (But note that this may be overcome if w0 + 100 is bigger than the enlargement step.)

Flattening

In order to resize in more than one step, the image can be flattened in its current state, thrugh this function:

gboolean lqr_carver_flatten( LqrCarver * carver);
 

The return value is FALSE in case of insufficient memory, TRUE otherwise.

This function destroys the current visibility map and reinitializes the multi-size image from its current state.

Note

Every time that the image is flattened (including when changing the resize direction) the original image and all information about it is lost.