Upload and insert hosted images into Org files

Published on Nov 9, 2021, by Junji Zhi

Automating image workflows can minimize the friction of dealing with images. This is useful when you need to insert images or screenshots into your blog articles

Automate uploading images to the Cloud

I use uPic.

NOTE: This app is available in Mac OS X only.

You can follow the instructions to configure Github as the hosted service. There are other image hosted services too.

Add a shortcut for taking screenshots and auto uploading to the service:

Shortcut for taking sceenshots and uploading
images

Now pressing Cmd + F8 allows me to select the screen area to capture.

When done capturing, it automatically uploads and add the image URL to the clipboard!

Insert images into Org files

If you don't need to preview the images, the simple solution is just yank (Ctrl + y) the URL into the org file.

However, if you need to convert Org files into other formats, e.g., Markdown, Pandoc has some quirks about dealing with image URLs.

To setup proper image links, we need to add at least #+CAPTION on top:

#+CAPTION: label
[[/path/to/image]]

which leads to my snippet to automate creating image link from clipboard:

# -*- mode: snippet -*-
# name: Add image link (from clipboard)
# key: <i
# --
#+CAPTION: ${1:Caption}
[[`(current-kill 0)`]]

Summary: My workflow

  • Press Cmd + F8 to take a screenshot and get the image URL in clipboard
  • Type <i and TAB
  • Enter a caption and TAB
  • Press C-c TAB to toggle the image view



 Share: