A very basic python script that does it:
#!/usr/bin/env python
from gimpfu import *
def selectionMargins(image):
selection,x1,y1,x2,y2=pdb.gimp_selection_bounds(image)
if not selection:
pdb.gimp_message("No selection")
else:
gimp.message('L=%d\nU=%d\nR=%d\nD=%d' % (x1,y1,image.width-x2,image.height-y2))
### Registration
desc='Show selection margins'
register(
'selection-margins',desc,desc,'','','2019',desc,'*',
[(PF_IMAGE, "image", "Input image", None),],[],
selectionMargins,menu="<Image>/Select"
)
main()
- Copy the script to a text file with
.py
extension (note: python is sensitive to the indentation of the code)
- See Edit>Preferences>Folder>Plugins for the folder whre the resulting file should be
- On OSX and Linux, make it executable
- The menu entry is at the bottom of the
Select
menu in an image window.
- Output is in a dialog or in the error console window if it up
It wouldn't be difficult to improve the script to append to a CSV file a line with the image file name/path and the values.