Is it possible to take an image from the clipboard and output it to a file (using X)?I can do this with text easily:$ xclip -selection c -o > file.textBut when I try the above with an image nothing is written.The reason I want to do this is I don't have an image editor installed, and it got me thinking whether I could do this without installing one.
Copy image from clipboard to file
scripting;x11;images;clipboard
You can actually do this with xclip. The secret is the -t option, which refers you to the ICCCM Section 2.6.2. Which I confess I don't blame you for failing to read... Anyway, an example, I have just right-clicked your avatar in Chromium and selected Copy Image:See what targets are available: $ xclip -selection clipboard -t TARGETS -oTARGETSimage/pngtext/htmlNote the image/png target; go ahead and get it:$ xclip -selection clipboard -t image/png -o > /tmp/avatar.png$ see /tmp/avatar.png    # yep, that's itNOTE: Some research shows that you need xclip from SVN revision 81 (from April 2010) or later to have the required -t option. Or apply the patches yourself.