-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow getting image data from the system clipboard #2949
Comments
This is likely something that can already be implemented manually. If you copy a file in the OS file manager and then use
I tested this on Linux, but it likely behaves the same on other operating systems. (If it doesn't, we should probably harmonize the behavior across platforms instead.) When you have multiple files copied in the system clipboard, you will have one You can then parse this string and load the image file as a resource based on its file extension. For example, you could use the File class and the Image class' To determine whether the clipboard contains a file or text, check if the string starts with |
The problem with that method is that it doesn't work if I copy image data from, say, GIMP (or even from Google Images), then it only returns an empty |
When I made this tool: FastRecolour (a pretty useless tool honestly) I was looking into how to copy image data to & from the clipboard and couldn't figure it out. I tried using C# in the Godot mono-build but I think the data was corrupted or something when pasting (not skilled enough with C# to know if it deserved a bug report). I ended up successfully making an external executable file (copypaste.exe) included alongside my Godot game and would use when handling clipboard image data. here's the C# source code for my copypaste.exe executable
This is a very very clunky method however. All I can do is toss my vote in for a GDScript method of properly handling clipboard image data. |
Describe the project you are working on
My project's user inputs are images. The planned ways to accept said images are:
1: Dragging an image into the application,
2: Clicking the image well to open a
FileDialog
, and3: Pasting from the Clipboard
Describe the problem or limitation you are having in your project
Currently, you can only grab
String
s from the Clipboard. Image data, files, or really anything else? Nope!Describe the feature / enhancement and how it helps to overcome the problem or limitation
Updating Clipboard support to include additional formats (image data, sounds, videos, etc.) would help people a lot.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If this enhancement will not be used often, can it be worked around with a few lines of script?
Currently, no, because you can only grab
String
s from the Clipboard.Is there a reason why this should be core and not an add-on in the asset library?
In my honest opinion, features that use/require system data should be core. Something as simple and useful as, for example,
OS.get_screen_size()
, shouldn't be separate from the rest of the OS functionsThe text was updated successfully, but these errors were encountered: