So, I tried the following

xclip -se c -t image/png -i imagefile.jpg

This does indeed copy the image into clipboard, and I can paste it into gimp, or paste it into a new image file as in the following.

xclip -se c -t image/png -o > newimage.jpg

But, when I try to paste image copied in this way, I can't paste it into facebook messenger or posts. Why is that? And how do I get around this?

N.B I use xfce4-screenshooter, and it has an option to save screenshot to clipboard. If I use that I can paste that image data into facebook messenger and posts. So, it must be a problem with either my process or with xclip itself. What does xfce4-screenshooter uses?

  • 3
    this might help superuser.com/a/1098582
    – Bart
    Aug 24, 2019 at 12:18
  • Yeah, my xclip version is 0.12. I'll get back to you after updating it. Thanks
    – 3N4N
    Aug 24, 2019 at 12:53

2 Answers 2


From superuser.com/a/1098582. I'm copying it here because the OP for that answer isn't related to xclip specifically. Keeping the answer here will be beneficial to people who come to this question in the future.

Install xclip (be sure the version is at least 0.12+svn84, because 0.12 is not enough); then, use the following method to copy image to system clipboard:

cat /path/to/image | xclip -selection clipboard -target image/png -i

Update: the current version of xclip in apt repo for Ubuntu 20.04 is 0.13, which is new enough for this answer to work.


This could also be a reason it doesn't work: https://github.com/astrand/xclip/issues/110

According to this issue, some programs are picky about the format of image they'll accept. Many clipboard providers convert the image on-the-fly to the format the program wants, but xclip doesn't do this. In particular, if you copy in a JPEG image, it will not work for some programs, such as Discord. They mention GIMP as an exception which accepts JPEG directly.

The issue provides a temporary workaround: convert the image to png first.

convert image.jpeg png:- | xclip -selection clipboard -t image/png -i

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .