Skip to content

Instantly share code, notes, and snippets.

@feiss
Last active March 24, 2021 22:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save feiss/5b78e0220fbd13aa95dbed96f027a679 to your computer and use it in GitHub Desktop.
Save feiss/5b78e0220fbd13aa95dbed96f027a679 to your computer and use it in GitHub Desktop.
GIMP plugin in Python for copying current selection coordinates to clipboard
#!/usr/bin/python
from gimpfu import *
import os
def plugin_main(timg, tdrawable):
non_empty, x1, y1, x2, y2 = pdb.gimp_selection_bounds(timg)
if (non_empty):
os.system('echo {}, {}, {}, {} | xsel --clipboard'.format(x1, y1, x2 - x1, y2 - y1))
else:
os.system('echo "no selection" | xsel --clipboard')
register(
"copy_selection_coordinates",
"Copies active selection coordinates to clipboard in x,y,w,h form",
"Copies active selection coordinates to clipboard in x,y,w,h form",
"Diego F. Goberna",
"Diego F. Goberna",
"2017",
"<Image>/Edit/Copy _selection coordinates",
"RGB*, GRAY*, INDEXED*",
[],
[],
plugin_main)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment