Skip to content

Instantly share code, notes, and snippets.

@janfri
janfri / copy-selection-coordinates.py
Created April 12, 2018 10:31 — forked from feiss/copy-selection-coordinates.py
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')