Skip to main content

add my reborder script and document it

ID
30e916b
date
2023-05-02 18:33:03+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
0c0667a
message
add my reborder script and document it
changed files
4 files, 21 additions, 2 deletions

Changed files

images/README.md (1365) → images/README.md (1911)

diff --git a/images/README.md b/images/README.md
index 8d39498..fd95b98 100644
--- a/images/README.md
+++ b/images/README.md
@@ -34,7 +34,7 @@ These scripts are for working with images and other visual material.
     </p>
     I often use this when making images for my website, to create identical light mode and dark mode screenshots.
   </dd>
-  
+
   <dt>
     <a href="https://github.com/alexwlchan/scripts/blob/main/images/pdfthumb">
       <code>pdfthumb</code>
@@ -43,4 +43,23 @@ These scripts are for working with images and other visual material.
   <dd>
     get a PNG thumbnail of a specific page of a PDF, for example <code>pdfthumb pattern.pdf --page=3</code> will create a thumbnail of the third page.
   </dd>
+
+  <dt>
+    <a href="https://github.com/alexwlchan/scripts/blob/main/images/reborder">
+      <code>reborder [PATH] [BORDER_WIDTH]</code>
+    </a>
+  </dt>
+  <dd>
+    replace empty space around an image with consistent white padding.
+    I use this when cleaning up screenshots, to get equal padding around the entire image.
+    <p>
+      <table>
+        <tr>
+          <td><img src="examples/reborder_original.png"></td>
+          <td>&rarr;</td>
+          <td><img src="examples/reborder_50.png"></td>
+        </tr>
+      </table>
+    </p>
+  </dd>
 </dl>

images/examples/reborder_50.png (0) → images/examples/reborder_50.png (46151)

diff --git a/images/examples/reborder_50.png b/images/examples/reborder_50.png
new file mode 100644
index 0000000..ea5985e
Binary files /dev/null and b/images/examples/reborder_50.png differ

images/examples/reborder_original.png (0) → images/examples/reborder_original.png (46045)

diff --git a/images/examples/reborder_original.png b/images/examples/reborder_original.png
new file mode 100644
index 0000000..879f19f
Binary files /dev/null and b/images/examples/reborder_original.png differ

reborder (590) → images/reborder (602)

diff --git a/reborder b/images/reborder
similarity index 95%
rename from reborder
rename to images/reborder
index 8fbe1b9..5e848d4 100755
--- a/reborder
+++ b/images/reborder
@@ -19,7 +19,7 @@ BORDER_WIDTH="$2"
 NOEXT=${PATH%.*}
 EXT=${PATH##*.}
 
-NEW_PATH="$NOEXT"_reborder."$EXT"
+NEW_PATH="$NOEXT.reborder_$BORDER_WIDTH.$EXT"
 
 /usr/local/bin/convert \
   -background none \