Rod wrote:
AWESOME works perfect ofnuts! Even with 4 layers of content they autocrop very nicely.
![Smile :)](./images/smilies/icon_smile.gif)
Besides the Hello script that has got to be the smallest Python script i have seen to date.
Could you tell me how to edit the script if i wanted all the layers to become unlinked after the cropping takes effect?
Python can be quite terse, and the object classes defined by the python-fu interface are well done. I've yet to find a real-life case where Scheme is more suitable than Python for Gimp scripts.
For your request, just add the line "layer.linked=False" as below. Pay attention to the indenting, python is very fussy, indenting should be consistent (tabs and spaces are different, and I use tabs).
def autocropLinkedLayers(image,drawable):
for layer in image.layers:
if layer.linked:
print 'Autocropping layer %s' % layer.name
pdb.gimp_image_set_active_layer(image, layer)
pdb.plug_in_autocrop_layer(image, layer)
layer.linked=False