astrand / xclip

Command line interface to the X11 clipboard
GNU General Public License v2.0
1.07k stars 75 forks source link

WebP images that have been inserted to the clipboard using xclip can't be pasted into other programs #151

Open rodrigomorales1 opened 6 months ago

rodrigomorales1 commented 6 months ago

Steps to reproduce

  1. Insert a WebP image to the clipboard using $ xclip -selection clipboard -t image/webp /tmp/a.webp. You can download a simple image from Wikimedia Commons using the following command: $ wget -O /tmp/a.webp 'https://upload.wikimedia.org/wikipedia/commons/c/c6/Vunosnii-balcon.webp'
  2. Open any of the following programs: Inkscape, GIMP, LibreOffice
  3. Try pressing Ctrl+v to insert the WebP image in the program

What happened?

Although the image is in the clipboard, pressing Ctrl+v doesn't paste the image in the program (be it Inkscape, GIMP or LibreOffice)

What should have happened?

Upon pressing Ctrl+v, the image should have been pasted into the program.

Additional information

When I open the image in Mozilla Firefox 125.0.3 and I right click on the image and I choose the option Copy Image, I can then paste it in any of the aforementioned programs: Inkscape, GIMP and LibreOffice. The image can't be pasted into those programs when the image has been inserted to the clipboard using $ xclip -selection clipboard -t image/webp /tmp/a.webp.

System information

rodrigomorales1 commented 6 months ago

I have opened an issue related to this topic in the Inkscape bug's repository. Here's the link.

schrmh commented 1 week ago

Try xclip -selection clipboard -t image/webp -i /tmp/a.webp (with -i)
This worked for me when your command did not.

Honestly, I was originally speculating about if common terminal emulators don't provide a selection target for images but after clearing by using xclip -selection clipboard /dev/null I was able to also use the command you tried and paste the image into another application then. So maybe we just copied something before / something took priority over image targets. (Before using -i I also tried it with other image files, so this is not webp specific.) Well, now I get

TARGETS
image/webp

when checking targets via xclip -o -target TARGETS -selection clipboard. (Sadly I did not check those prior and I can't seem to get into not being able to paste the image again.)

rodrigomorales1 commented 1 week ago

@schrmh I downloaded the same image from my first comment and I used the flag -i as you suggested.

wget -O /tmp/a.webp 'https://upload.wikimedia.org/wikipedia/commons/c/c6/Vunosnii-balcon.webp'
/usr/bin/xclip -selection clipboard -t image/webp -i /tmp/a.webp

I could not paste the image in neither Libreoffice, GIMP nor Inkscape in Ubuntu 24.04.1 LTS.

Gimp showed the message "There is no image data in the clipboard to paste."

Inkscape showed the message "Nothing on the clipboard".

Libreoffice just did nothing when I pressed Ctrl+v. Nothing happened when I right-clicked anywhere in the document and then clicked on "Paste".

System information

lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.1 LTS
Release:    24.04
Codename:   noble

All of the programs below were installed using sudo apt install <package-name>.

$ /usr/bin/gimp --version
GNU Image Manipulation Program version 2.10.36
$ /usr/bin/inkscape --version
Inkscape 1.2.2 (b0a8486541, 2022-12-01)
$ /usr/bin/libreoffice --version
LibreOffice 24.2.6.2 420(Build:2)