command-line image resizing.

friday, december 27th, 2024.

A few days ago, I wrote about blogging from my phone. Usually, when I blog, I'll include an image or two in each post. I've been making these by resizing them and dithering them manually in GIMP. Unfortunately, I can't do this on my phone! So I hacked together a Perl script to download photos I take and share on Dropbox, then resize & dither them using wget and ImageMagick right on the Raspberry Pi hosting this website.

Here's what the output images look like:

A bunch of Flesh & Blood cards.

And here's the grab_image.pl script I used to download and convert the images. Now I can take photographs on my phone, share them with my Raspberry Pi via Dropbox, and post 'em on my website using private Dropbox share links:

$ ~/scripts/grab_image.pl "https://www.dropbox.com/share_url.jpg&dl=0"
downloading "image_1.jpg"... done!
converting "image_1.jpg" to "image_1.png"... done!
All files downloaded and converted! Here's the results:
-rw-r--r--  1 chotrin  chotrin   2.3M Dec 27 14:50 image_1.jpg
-rw-r--r--  1 chotrin  chotrin  41.4K Dec 27 14:50 image_1.png
-

It's a pretty hacky solution, but it works, and that's the important bit!

Until next time, be well! :)