Gimp-Forum.net
Pasting from the Clipboard created by PrtScr key - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP)
+---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions)
+---- Thread: Pasting from the Clipboard created by PrtScr key (/Thread-Pasting-from-the-Clipboard-created-by-PrtScr-key)



Pasting from the Clipboard created by PrtScr key - alanm - 06-06-2020

I have been unable to discover a way for a script to paste from the clipboard (clipboard image created by "PrtScr" key). I can obviously use the edit>paste option to do it manually (which works), but the procedure in a script using "gimp-edit-paste-as-new-image" does not return an image. I realise that the procedure notes state

"This procedure pastes a copy of the internal GIMP edit buffer to a new image. The GIMP edit buffer will be empty unless a call was previously made to either 'gimp-edit-cut' or 'gimp-edit-copy'. This procedure returns the new image or -1 if the edit buffer was empty."

and the clipboard is not mentioned (whereas it is in pasting brushes and patterns).

I have not been able to find anything on this after many hours of searching.

My question is "Is it possible in TinyScheme/ScriptFu?"


RE: Pasting from the Clipboard created by PrtScr key - Ofnuts - 06-06-2020

The paste-as-brush and paste-as-pattern are scripts so if they can do it, Python can do it. Unfortunately, they both start with:

Code:
(let* ((pattern-image (car (gimp-edit-paste-as-new-image)))

so you are out of luck. I am not too surprised by this, the Gimp scripts/plugins are purposely unable to interfere with the UI, and copy/pasting to the system clipboard would be such a case.

OTOH Gimp has its own screenshot function (Filer>Create>Screenshot), and my usual screenshot utility saves the image in /tmp and calls Gimp on it.