6
I have an image, Test.png
, which I want to copy to the clipboard from the terminal as part of a Bash script so I can paste it into Word.
I've tried using pbcopy
like this:
$ cat Test.png | pbcopy
However, when I try to paste the contents of the clipboard into Word, I get multiple pages of random characters. I assume the clipboard is flagged as containing text, so pastes a text representation of the image bytes:
How can I correctly copy an image from the terminal? This appears to happen with all PNG images, but if it helps the image that I'm using is this one:
Unfortunately this doesn't work; when attempting to pasting into Word, there is no output at all. Thanks for your help though. – Aaron Christiansen – 2017-06-03T08:20:41.873
Hmm. The hash-bang script works perfectly for me. I can't think of anything to suggest, other than making sure that Word can import your image file through the normal menu options first. – squaregoldfish – 2017-06-03T08:55:53.153
I tried the Bash
osascript
. I'll try the hash bang one and see if that works. – Aaron Christiansen – 2017-06-03T09:02:57.923Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change. – DavidPostill – 2017-06-03T15:10:02.160