Several questions have already been answered regarding copying images to the X clipboard, and the answer is always to use xclip
like so:
xclip -selection clipboard -t image/png -i image.png
This works, but only for PNG files. You might imagine that changing the -t image/png
to the correct MIME type, such as image/jpg
or image/jpeg
for JPEG files, would easily solve the problem, but this simply does not work:
xclip -selection clipboard -t image/jpeg -i other_image.jpg
The image is copied to the clipboard, but is not recognized by other applications as an image. In my case, copying a JPEG image, Discord refuses to paste any content, while Firefox pastes it as if it was text, resulting in some high quality Unicode soup of random CJK characters.
What is the correct way to copy a non PNG image to the X clipboard using xclip
?