Help Page for gimp-lqr-plugin

Liquid Rescale help page
The Liquid Rescale plugin is an implementation of the content-aware resizing by seam carving algorithm by Shai Avidan and Ariel Shamir. It aims at resizing pictures non uniformly while preserving the features of the picture, i.e. avoiding distortion of the important parts of the picture. It can also be used to remove portions of the picture in a consistent way. It works both ways, but enlarging gives better results if done in successive steps. It can use extra layers as masks to select which features of the image should be preserved and which should be discarded. The plugin works on the active layer or floating selection. If a selection is present, it is saved to a channel. If the layer has a transparency mask, an option is given to select the behaviour (apply/discard). ## User interface description ### Select new width and height In this section it is possible to choose the size and the mode of operation. It is advisable to rescale always in one direction at a time. If both the width and the height are changed, rescaling is performed by default on the width first, then on the height. This can be changed in the Advanced tab. The default operational mode is just liquid rescaling to the desired size. The other options are to apply liquid rescaling or the standard scaling back to the original size once the first liquid rescaling is done. Note that the final size can be set automatically when removing objects, see below ### Feature masks #### Quick guide The easiest way to manually select the features of the image that you want to protect or discard is the following: Select the layer you want to resize (not a floating selection) and invoke the plugin Press the "New" button in the "Feature preservation mask" section (this will create a transparent layer, with 50% opacity, and pick an appropriate colour). Paint on the areas of the image you want to preserve Press the refresh button if you want to see the mask you painted Repeat everything for the features to discard If you want to remove portions of the image, you can choose the scaling direction (horizontal/vertical) and finally press the "Auto size" button to determine the final size automatically (this is only reliable when dealing with very simple masks). Note #1: discarding a feature implies that it will be removed if shrinking the layer, but it will be inflated if enlarging it, since it will be treated as unimportant background which can be removed or expanded as needed. Note #2: preservation of features is not possible if enlarging too much, because the inflation process is the exact reverse of the shrinking process, so the maximum amount of pixels you can add to a layer corresponds to the amount of pixels which are not protected. For example, if you have a 1000 pixel wide image and you have marked a 800 pixel wide area for protection, the final width should be less than 1200 pixels. If you want to enlarge more, do it in steps. #### Full description In the "Feature preservation mask" section it is possible to specify if there are regions of the image which should be preserved from modification, by checking the "Activate feature preservation" box, and by choosing a layer among the ones which belong to the current image (different from the active one, which is to be rescaled) in the "Available layers" menu. The "New" button creates a transparent layer with 50% opacity and an appropriate name, and sets it as the selected layer mask (note that this fails if the plugin is invoked on a floating selection, because this does not allow to work on other layers). It also sets the foreground colour to green; the previous colour is restored when the dialog is closed. The intensity of the effect of the mask on each pixel is obtained as the average on the pixel's colour channels, multiplied by the alpha channel. Thus, for an RGB layer with an alpha channel, the maximum value is achieved on white pixels, while black ones and transparent ones are ignored. In general, it is advisable to work in monochrome, and modulate the intensity by the transparency in case fine tuning is needed, e.g. by using the quickmask. The size and position of the selected layer can be arbitrary, the plugin will only use those portions which overlap with the active layer. The "Strength" scale can be used as a global parameter to modulate the feature preservation. Note that the strength value automatically accounts for the size of the image, but not for that of the masked areas: thinner selection areas (in the sense of the resizing) need higher strength values, and vice-versa. The Feature discard selection section is nearly identical to the previous one, but the effect is reversed, and the default colour for the "New" button is red instead of green. Furthermore, there's an additional button, "Auto size", which sets the final size of the layer automatically. The nearby menu can be used to determine if the scaling will be performed in the horizontal or in the vertical sense (the other direction will be set to its initial value). Note that this option is only suitable for naive object removals, since the final size is determined by simply finding out the maximum number of pixels in a line for which the mask value is above a given threshold, and it may fail if the masks are non-trivial. The threshold is set to the 50% of a full RGB colour (e.g. red in the default setting). ### Output This page has a number of options related to the output of the plugin. Output on a new layer. Specifies if the resized image should be written on a new layer. By default, it is off. Resize image canvas. Specifies whether the image canvas should be resized to meet the new size of the active layer. By default, it is on. Resize preserve/discard layers. Specifies whether the layers used to manually select the features of the image will be resized along with the active layer. If this option is checked, those layers will be first cropped to the active layer's size, then they will undergo the same seam carving and inserting process as the active layer. By default, it is on, but it is only active when some layers are selected in the "Feature masks" page. Output the seams on a new layer. Specifies whether to create a new layer with the seams map. The seams colour range can be manually choosen with the two buttons on the right. The seams are computed on the original layer as far as they are needed for the new size (e.g. there will be 100 seams if reducing or enlarging by 100 pixels), the remaining areas are transparent. In order to read the result, use this option together with Output on a new layer, and overlay the seam map to the original layer. If you rescale in two directions at once, you will obtain two maps, but the second one will be computed over an invisible intermediate image, so this is not very useful. The same applies in the case you choose to rescale back to the original size with LqR. ### Advanced This page has some options which can be used to tweak the plugin behavior. Seams rigidity. Use this value to give a negative bias to the seams which are not straight. May be useful to prevent distortions in some situations, or to avoid artifacts from pixel skipping (it is better to use low values in such case). The bias is proportional to the difference in the transversal coordinate between each two successive points, elevated to the power of 1.5, and summed up for the whole seam. Seams max step. This option lets you choose the maximum transversal step that the pixels in the seams can take. In the standard algorithm, corresponing to the default value step = 1, each pixel in a seam can be shifted by at most one pixel with respect to its neighbors. This implies that the seams can form an angle of at most 45 degrees with respect to their base line. Increasing the step value lets you overcome this limit, but may lead to the introduction of artifacts. In order to balance the situation, you can use the rigidity setting. Gradient function. It is possible to choose which function is to be used to calculate the energy map of the image. For each pixel in the image, the x,y components of the gradient are computed from the pixel's four nearest neighbors. The exact form of the energy map depends on the choice of the gradient function, and this in turn determines which elements of the image are more important, and should thus be preserved, and which are not, and can be removed (if shrinking) or inflated (if enlarging). Using the Null function in conjunction with the feature preservation mask can be used to override completely the automatic feature detection, thus allowing the user to generate his own energy map (e.g. by another plugin). Rescale order. When rescaling in both directions at the same time, it can be choosen whether to resize first in the horizontal and then in the vertical direction, or vice versa.