Reputation: 517
I have built an image viewing app using electron js for windows 10. I am able to add viewed images to the clipboard using clipboard.writeImage. However, using this, I can only paste into word and other editing applications. I would like to be able to paste my image as a file as well so then it can be copied into folders. Is there a way to do this in nodejs? I also do not mind if the command is given in powershell or cmd as i can call either one from nodejs. Many Thanks
Upvotes: 2
Views: 2112
Reputation: 437062
If you save the images to (temporary) files, you can copy references to these files to the clipboard with Set-Clipboard -LiteralPath
.
Upvotes: 2
Reputation: 1179
In Powershell it could look something like this:
$Image = Get-Clipboard -Format Image
$ImageFile = 'C:\scripts\test\image.jpg'
$Image.Save($ImageFile,'Jpeg')
More info on what you can do with $Image after you've captured it here: Image Class and the supported formats can be found here: ImageFormat Class
Upvotes: 0