Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Divide selection using guides
#9
Hi goran,

Thank you for sharing your first script. I appreciate getting into new things isn't easy so will just mention one thing.

In gimp if you do the menu item:
Filters -> Python-Fu -> Console

Then hit the Browse button

You can search for the function you want to call, so in your case gimp_selection_bounds.

When that comes up hit the apply button. Then look in the console window, and copy and paste the result into your code:

non_empty, x1, y1, x2, y2 = pdb.gimp_selection_bounds(image)

You can use the above one line to replace the following lines you currently have (changing non_empty and image to your preferred variable names) as there is no need for the multiple calls:

pdb.gimp_selection_bounds(img)
selection_exists = pdb.gimp_selection_bounds(img)[0]
x1=pdb.gimp_selection_bounds(img)[1]
y1=pdb.gimp_selection_bounds(img)[2]
x2=pdb.gimp_selection_bounds(img)[3]
y2=pdb.gimp_selection_bounds(img)[4]
Reply


Messages In This Thread
Divide selection using guides - by goran - 04-14-2023, 09:33 AM
RE: Divide selection using guides - by PixLab - 04-14-2023, 02:11 PM
RE: Divide selection using guides - by goran - 04-14-2023, 04:20 PM
RE: Divide selection using guides - by Ofnuts - 04-14-2023, 04:46 PM
RE: Divide selection using guides - by PixLab - 04-15-2023, 04:02 AM
RE: Divide selection using guides - by goran - 04-15-2023, 11:01 AM
RE: Divide selection using guides - by PixLab - 04-16-2023, 04:05 AM
RE: Divide selection using guides - by denzjos - 04-15-2023, 07:50 AM
RE: Divide selection using guides - by goran - 04-15-2023, 05:55 PM
RE: Divide selection using guides - by denzjos - 04-18-2023, 07:01 AM
RE: Divide selection using guides - by teapot - 04-15-2023, 11:14 PM
RE: Divide selection using guides - by goran - 04-16-2023, 06:16 AM
RE: Divide selection using guides - by Krikor - 04-18-2023, 06:09 PM
RE: Divide selection using guides - by goran - 04-18-2023, 06:53 PM
RE: Divide selection using guides - by Krikor - 04-18-2023, 07:02 PM
RE: Divide selection using guides - by goran - 04-19-2023, 06:26 AM
RE: Divide selection using guides - by PixLab - 04-19-2023, 01:41 PM
RE: Divide selection using guides - by denzjos - 04-19-2023, 08:39 AM
RE: Divide selection using guides - by goran - 04-19-2023, 11:36 AM
RE: Divide selection using guides - by Krikor - 04-19-2023, 06:18 PM

Forum Jump: