11-11-2024, 03:14 PM
Can't think of a better way than is_empty = pdb.gimp_selection_is_empty(image) or non_empty, x1, y1, x2, y2 = pdb.gimp_selection_bounds(image) but both should be quick. You would use that only once anyway, if you know what your plugin code is doing with the selection.
Looking at your plugin, a layer with the knit pattern over the original image blurred with Filter > Blur > Pixellize of adequate size would do the trick (yes, pixellize is the average and not the median...). And if you take the pattern size (width, height, bpp = pdb.gimp_pattern_get_info(name)you can do a plugin that auto-adapts to the pattern used (just pixellize to that size).
Looking at your plugin, a layer with the knit pattern over the original image blurred with Filter > Blur > Pixellize of adequate size would do the trick (yes, pixellize is the average and not the median...). And if you take the pattern size (width, height, bpp = pdb.gimp_pattern_get_info(name)you can do a plugin that auto-adapts to the pattern used (just pixellize to that size).