GIMP

layer effects

Script for Canvas to Layer

cheese

A script that makes GIMP reduce the canvas size to the selected layer.

download

Download the script. Also, the simple script is not a long read:


def canvas_to_layer(image, drawable):
    offset_x, offset_y = pdb['gimp-drawable-offsets'](drawable)
    offx = 0 - offset_x
    offy = 0 - offset_y
    
    pdb['gimp-image-resize'](image, drawable.width, drawable.height, offx, offy)

files related to subject

The downloadable version also contains a script that will discard not visible layers when merging. While GIMP can do this through the gui, it is not available to the pdb yet.