the image of the one you're try to crop of.
usually it's the called image passed in from running plug-in
and the layer is the drawable you're trying to crop as well.
image is the image that the layer belongs to that you're trying to crop.
from your code you have image.layer then you're calling another function that deals with image.layers.
so I would guess you'd want to pass in the image to that function as well and use that as your image parameter.
something like
def trim_layers(image):
trim_layer_group(image, image.layers)
def trim_layer_group(image, group):
for layer in group:
if pdb.gimp_item_is_group(layer):
trim_layer_group(image, layer.layers)
else:
pdb.plug_in_autocrop_layer(image, layer)