Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is mask_bounds if the selection contains inner holes?
#1
What is mask_bounds if the selection contains inner holes?

Such as in:
[Image: CagusVd.png]

Or is there some other way to get the bounds?
Reply
#2
Code:
non_empty, x1, y1, x2, y2 = pdb.gimp_selection_bounds(image)

AFAIK this returns the smallest rectangle that contains all selected pixels. So that would be your outer rectangle.
Reply
#3
So I can't get the inner bounds from anywhere, even though they're visible?
Reply
#4
You can:
Code:
pdb.plug_in_sel2path(image,None)

This creates a vector/path with one stroke per rectangle. Each stroke appears to be 4 "triplets" (24 coordinates: 4 corners times 3 points(*) times 2 coordinates). The difficulty may be to figure out the inner ones from the outer ones (ie, which are "holes"). But if you have only one outer one, the rest being holes, this isn't too hard.

See here for an introductions to paths if needed.

See there for a bunch of scripts that deal with path, in particular the "pathSummary" function in ofn-path-edits.

(*) since lines from the corners are straight lines, the "tangent handles" have the same coordinates as the anchors.

See here for an introductions to paths if needed.
See there for a bunch of scripts that deal with path, in particular the "summary" function in ofn-path-edits.
Reply


Forum Jump: