GIMP Script-fu
sg-extend-layer
Not logged in
Command:
Extend to Image Size
Menu:
"<Image>/Layer/Extend to Image Size"
PDB Name:
script-fu-sg-extend-layer
Download:
sg-extend-layer.scm (after the page appears, click on the "Download" command)
License:
GPLv2+

Description:

This script will scale the boundaries of the current layer to fit the image size. If there is no selection when the script is run, the entire layer is scaled to the image size. If there is a selection present then that selection is protected from scaling and only the portion of the layer outside the selection will be scaled. (As a special case, if the entire layer is selected then the 1-pixel edge around the periphery of the layer will be extended to the image size.)

The script is generally intended for extending the background behind a subject without modifying the subject itself.

As an example, when "Extend to Image Size" is applied on the following image, the region between the selection (the black and white dashed line) and the layer edge (the black and yellow dashed line) will be scaled outwards to fill the image (the gray checkerboard). The selected region will not be scaled (or moved).

The following result will be produced.