The downloaded image data is piped back into the clipboard as an image/png via xclip -selection clipboard -target image/png.The URL is provided as a parameter to curl, which downloads the content and writes it to standard output.That HTML output is piped through xmllint -html -xpath - in order to extract the URL to standard output, which points to a Google Docs content server.The xclip -selection clipboard -o -t text/html command extracts the HTML from the clipboard and writes it to standard output.| xclip -selection clipboard -target image/png $(xclip -selection clipboard -o -t text/html \ So all we have to do is extract the URL from the HTML, download it via curl, and send that output back to the clipboard! Solution Ok, we've got some HTML in there, and inspecting that, we have an img tag with a source URL. When copying an image from a Google Doc in Chrome, the clipboard contains the following data types: $ xclip -selection clipboard -o -t TARGETS This solution works on Linux and requires xclip, xmllint, and curl.Īll it requires is a "copy" from the Google Doc as normal (Ctrl c or right-click and Copy on the image), and then an execution of a one-liner CLI command in a terminal to "fix" the clipboard so that it contains the actual image. I wouldn't necessarily call this simple but it is kind of a fun hack.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |