Posts: 6,315
Threads: 271
Joined: Oct 2016
Reputation:
561
Operating system(s):
Gimp version: 2.10
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).
Posts: 211
Threads: 40
Joined: Oct 2016
Reputation:
3
Operating system(s):
Gimp version: 2.10
11-11-2024, 03:18 PM
(This post was last modified: 11-11-2024, 03:21 PM by trandoductin.)
what? are you saying I can pixellize and having use a pattern shape that isn't rectangular? I know my pattern is rectangular but the way I color it is a V shape kind of. I am super curious now
Currently I make selection for every V-shape on the image and then use average color to color the V-shape (not rectangle).
aha used Gravatar to show my avatar now haha
Posts: 211
Threads: 40
Joined: Oct 2016
Reputation:
3
Operating system(s):
Gimp version: 2.10
I thought if pixelize can't do shape then i can at least use it to approximate colors and dodge using a bunch of repeated histogram calls.
So now my code is 10% faster because i use get_pixel to get the pixelized color.