60 lines
2.5 KiB
Plaintext
60 lines
2.5 KiB
Plaintext
<p>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</p>
|
|
|
|
<h2 id="automate-uploading-images-to-the-cloud">Automate uploading images to the Cloud</h2>
|
|
|
|
<p>I use <a href="https://github.com/gee1k/uPic">uPic</a>.</p>
|
|
|
|
<blockquote>
|
|
<p><strong><em>NOTE:</em></strong> This app is available in Mac OS X only.</p>
|
|
</blockquote>
|
|
|
|
<p>You can follow the
|
|
<a href="https://blog.svend.cc/upic/tutorials/github/">instructions</a> to
|
|
configure Github as the hosted service. There are other image hosted services too.</p>
|
|
|
|
<p>Add a shortcut for taking screenshots and auto uploading to the
|
|
service:</p>
|
|
|
|
<p><img alt="Shortcut for taking sceenshots and uploading images" src="https://i.loli.net/2021/11/09/OKtYbLASjcsRWE4.png" /></p>
|
|
|
|
<p>Now pressing <code class="language-plaintext highlighter-rouge">Cmd + F8</code> allows me to select the screen area to capture.</p>
|
|
|
|
<p><strong>When done capturing, it automatically uploads and add the image URL to the clipboard</strong>!</p>
|
|
|
|
<h2 id="insert-images-into-org-files-1">Insert images into Org files</h2>
|
|
|
|
<p>If you don't need to preview the images, the simple solution is just
|
|
yank (Ctrl + y) the URL into the org file.</p>
|
|
|
|
<p>However, if you need to convert Org files into other formats, e.g.,
|
|
Markdown, <a href="https://pandoc.org/">Pandoc</a> has some
|
|
<a href="https://github.com/jgm/pandoc/issues/5454">quirks</a> about dealing with
|
|
image URLs.</p>
|
|
|
|
<p>To setup proper image links, we need to add at least #+CAPTION on top:</p>
|
|
|
|
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#+CAPTION: label
|
|
[[/path/to/image]]
|
|
</code></pre></div></div>
|
|
|
|
<p>which leads to my <a href="https://github.com/joaotavora/yasnippet">snippet</a> to
|
|
<strong>automate creating image link from clipboard</strong>:</p>
|
|
|
|
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># -*- mode: snippet -*-
|
|
# name: Add image link (from clipboard)
|
|
# key: <i
|
|
# --
|
|
#+CAPTION: ${1:Caption}
|
|
[[`(current-kill 0)`]]
|
|
</code></pre></div></div>
|
|
|
|
<h2 id="summary-my-workflow">Summary: My workflow</h2>
|
|
|
|
<ul>
|
|
<li>Press <code class="language-plaintext highlighter-rouge">Cmd + F8</code> to take a screenshot and get the image URL in
|
|
clipboard</li>
|
|
<li>Type <code class="language-plaintext highlighter-rouge"><i</code> and TAB</li>
|
|
<li>Enter a caption and TAB</li>
|
|
<li>Press <code class="language-plaintext highlighter-rouge">C-c TAB</code> to toggle the image view</li>
|
|
</ul> |