01-22-2018, 08:13 PM
Not 100%, there's a lot of seemingly empty layers, probably because sprites have some holes in them and are counted as objects/islands.
Anyways, this is my first python script ever so bear with me, in python-fu console:
I select a sprite, then run last line, then select next sprite, then run last line again etc...
This gives accurate results but tedious and time consumming so I need help with:
-step 4 of first post: how do I go over each pixel and select pixel with non-zero mask layer with "fuzzy select tool" with said parameters.
-step 7 and 8 of first post
Anyways, this is my first python script ever so bear with me, in python-fu console:
Code:
def crop_selection_to_new_layer(image):
img = image
prev_layer = img.active_layer
newlayer = pdb.gimp_layer_copy( img.active_layer, pdb.gimp_drawable_has_alpha( img.active_layer ) )
pdb.gimp_image_insert_layer(img, newlayer, None, -1)
bounds = pdb.gimp_selection_bounds(img)
pdb.gimp_layer_resize(img.active_layer, bounds[3] - bounds[1], bounds[4] - bounds[2], -bounds[1], -bounds[2])
img.active_layer = prev_layer
#crop selection to first image in list
crop_selection_to_new_layer( gimp.image_list()[0] )
I select a sprite, then run last line, then select next sprite, then run last line again etc...
This gives accurate results but tedious and time consumming so I need help with:
-step 4 of first post: how do I go over each pixel and select pixel with non-zero mask layer with "fuzzy select tool" with said parameters.
-step 7 and 8 of first post