Copy image data to clipboard

Is it possible to copy data to clipboard through script calls?


1. In development (PC or mac)


2. In production (anywhere)


EDIT: updated title to be more specific.
It is, although it doesn't seem to be widely supported: http://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript
Was looking at that yesterday but couldn't figure out how to get it to work.


I have seen references to clipboard.js, or a node module that provides access to the clipboard...but haven't tried those out yet.


Was hoping there was an easy way to do it cause having to install external JS requires you to modify the HTML file or something.
For the desktop clients, you may use the clipboard functionality in Node. For web browsers, it's a lot more difficult. You can, potentially, use the 'execCommand' function, though it may be restricted. I recommend first reading this page on why you'd need to use execCommand, and then this one is the one it links to, to talk about it.
For the desktop clients, you may use the clipboard functionality in Node. For web browsers, it's a lot more difficult. You can, potentially, use the 'execCommand' function, though it may be restricted. I recommend first reading this page on why you'd need to use execCommand, and then this one is the one it links to, to talk about it.
Oh, didn't know there was an easy way to use the clipboard in node.


Seems like these methods only support text though, so like image data wouldn't be copied.
Oh, didn't know there was an easy way to use the clipboard in node.

Seems like these methods only support text though, so like image data wouldn't be copied.

You can convert the image to a Data URL, which is text, but then when pasting you'd have the Data URL, not the image itself. Web browsers can interpret the Data URL as an image, though, so perhaps that's enough for you, depending on what you want to do.
There is no external API needed. The second answer in the thread i linked mentions document.execCommand, which is basic JavaScript: https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand
You can convert the image to a Data URL, which is text, but then when pasting you'd have the Data URL, not the image itself. Web browsers can interpret the Data URL as an image, though, so perhaps that's enough for you, depending on what you want to do.
One of my goals is to be able to be able to copy image data straight out of RM and into an image editor, without having to deal with temporary files or anything.
One of my goals is to be able to be able to copy image data straight out of RM and into an image editor, without having to deal with temporary files or anything.
Looks like there's a Node module that has a regular JS file equivalent that you can use. It'll have browser version restrictions, but since the packaged NWJS is based on Chrome 42, it should be just the right version to support it, so you should have good results with both the desktop client and web browsers. I suppose you can start by looking into that.
I'm looking for the solution, but I do not find anything. ! And I came across this post.!
Even if the tread is old, i share the solution for help other search same thing.
Given that no one seemed to share the solution
@Tsukihime
I do not know if this can help, but i found how to copy , paste and get information to clipboard.

Code:
require('nw.gui').Clipboard.get().get(); // this get the current data in clipboard

Code:
require('nw.gui').Clipboard.get().set('x:251, blabla !@$%^^'); // this will send to clipboard

Original thread: https://forums.rpgmakerweb.com/threads/copy-image-data-to-clipboard.52900/