0

I am trying to paste the current image from the system clipboard into a new image, just like File -> Create -> From Clipboard.

Perusing the object browser in the python-fu console, the most promising I could find is:

image = pdb.gimp_edit_paste_as_new_image()

But it returns None and does not create a new image. Also, its description specifically says it works on the internal GIMP clipboard, not the system clipboard.

The same is true for edit-gimp-paste - the description is clear about it not being used for the system clipboard.

Does anyone know whether there is another method to get at the system clipboard? Or is it definitely not possible to do that, maybe for security reasons?

AnoE
  • 8,048
  • 1
  • 21
  • 36
  • Are you looking for [this](https://stackoverflow.com/a/7045591/8353711)? – shaik moeed Feb 25 '20 at 12:59
  • @shaikmoeed, thanks for the link. Sure, if there was a way to directly access the system clipboard from the python interpreter embedded in GIMP, and if there was a way to then get that image data into the gimp subsystem, it would solve the problem. The answer you're linking is windows specific though (I'm on MacOS, but I hope GIMP's python-fu does not have system specific parts; GIMP itself is able to interact with the system clipboard just fine), and I see no hint whatsoever that it is possible to work with "raw" images in python-fu... – AnoE Feb 25 '20 at 13:13
  • @AnoE Relevant [`[python] [macos] clipboard`](https://stackoverflow.com/search?q=isanswered%3Ayes+is%3Aquestion+%5Bpython%5D+%5Bmacos%5D+clipboard) – stovfl Feb 25 '20 at 13:32
  • @stovfl: Again, thanks for pointing out how to access the clipboard from python. I'm looking for how to trigger the feature of GIMP which creates an image from the clipboard (or, second best, how to past from the clipboard to an image). – AnoE Feb 25 '20 at 15:18
  • @AnoE: Are you able to create a image in `python-fu` from file or `bytes array`? – stovfl Feb 25 '20 at 15:32
  • @stovfl: not that I know of... I mean, I can always step out of python-fu and do it completely different (e.g., get the image into an image file, and then have GIMP load the file, which should be possible from python-fu), but that would be pretty inelegant, I guess. – AnoE Feb 25 '20 at 15:45
  • @AnoE ***" not that I know of..."***: Do you have a link to the `python-fu` api? – stovfl Feb 25 '20 at 17:31

0 Answers0