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: