Streamlining image capture while blogging in Emacs.
When I am writing blog posts in org-mode I often want to take a screenshot, save it as a new file and insert an inline image link into the org buffer.
I tried out org-download-clipboard but found it a bit crufty, with no obvious way to specify the image filename. Instead, I wrote this short function that prompts for a filename, uses pngpaste (macOS only) to write the clipboard to file and inserts a link into the buffer.
(defun org-paste-to-inline-image (filename)
"Paste the clipboard to an inline image."
(interactive "FFilename: ")
(call-process "pngpaste" nil nil nil (expand-file-name filename))
(org-insert-link nil (concat "file:" filename)))
Here's an Inception-esque example of me using org-paste-to-inline-image
to write example.png
from the clipboard that I captured with the macOS native screencapture:
And here's the resulting org buffer: