37.10 Clipboard File Copy Paste

20210708

Consider this scenario. You have an image in a file that you want to paste into the body of an email rather than selecting the file as an attachment. The screenshot app, for example, allows a screenshot to be copied to the clipboard and that can then be pasted into Outlook in Office 365, or into a Teams post. But what if the image is already in a file. The xclip command comes in very handy here. The following does the magic:

xclip -selection clipboard -t image/png -i screen.png

The image is read from the supplied file with the -i or -in option (it could be a text file if you wanted to load text into the clipboard). The -selection loads the contents into the actual clipboard (technically, XA_CLIPBOARD) rather than selecting it as the primary as in XA_PRIMARY (or secondary as in XA_SECONDARY) selection. The -t or -target says this is a PNG image.

Once you have run that command simply paste into Outlook (Ctrl-V).



Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0