Last active
March 24, 2021 22:00
-
-
Save feiss/5b78e0220fbd13aa95dbed96f027a679 to your computer and use it in GitHub Desktop.
GIMP plugin in Python for copying current selection coordinates to clipboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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