Say I pick some png file and run the following command:
xclip -selection clip -t image/png image.png
I now have that image in my clipboard. If I paste it somewhere that accepts an image, it is pasted as expected and all is good.
Now instead consider that I press ctrl+V while being in the firefox address bar or in the text field I'm typing this in. The binary contents of the file are pasted verbatim into the text field, in some cases causing the browser to hang for a while.
Of course I know it doesn't make sense to paste an image there, but I sometimes do it accidentally, and then it causes problems.
When I instead paste an image I copied using firefox's "copy image" button, it doesn't get pasted when I try to paste it, so it must be possible to store it in the clipboard to allow for this behaviour.
How can I place an image in the clipboard without making the image get pasted verbatim as binary data into text fields? If it's possible to somehow place both an image and a text string (such as the path to the image or something) in the clipboard and have it pick the appropriate one when pasting, that would be awesome.
Best Answer
I copied an image into clipboard with xclip like you did and here's what list of targets I got:
and now if I copy an image from a web page I get this:
and for example setting target as text/html gives such output
So obviously it's xclip problem as stated in prev answer