def paste(self):
# ImageFile.LOAD_TRUNCATED_IMAGES = True
dirname = os.path.dirname(__file__)
command = ['/usr/bin/python3', os.path.join(dirname, 'bin/imageutil.py'), 'grab']
abs_fn, rel_fn = self.get_filename()
tempfile1 = "/tmp/imagepaste1.png"
command.append(tempfile1)
out = self.run_command(" ".join(command))
if out[:4] == "grab":
ret = sublime.ok_cancel_dialog("save to file?")
print("ret %r" % ret)
if ret:
shutil.move(tempfile1, abs_fn)
return rel_fn
else:
return None
# im = ImageGrab.grabclipboard()
# if im:
# abs_fn, rel_fn = self.get_filename()
# im.save(abs_fn,'PNG')
# return rel_fn
else:
print('clipboard buffer is not image!')
return None
评论列表
文章目录