DPReview.com is closing April 10th - Find out more

A shell script for resizing and adding border to photos

Started Jan 23, 2018 | Discussions thread
ForumParentFirstPrevious
Flat view
HaoAndHui Contributing Member • Posts: 539
A shell script for resizing and adding border to photos

Recently I started writing blog posts on my website, and sometimes need to include photos with EXIF information. I like the idea of having a white border around photos, just like Polaroid and Fujifilm instant photos, so I made this script to make it simple.

The script currently can add borders, and write EXIF text below the photo; As well as resizing and reducing of photos.

The script uses ImageMagic® mainly, ExifTool is also needed if you want to remove EXIF from the photo itself, both of them can via Homebrew.

I've only tested it on Mac, later I'll find a Linux machine and test it as well.

https://github.com/haozhexu/bor

Command line example:

(add a border with sizes equal to 5% width and 10% height of original photo, write EXIF on the bottom right portion of the border using medium font size, reduce the image size to 80% and reduce its quality to 70%)

./bor.sh -b 5%x10% -e cameramodel,focallength35,fnumber,exptime,isospeed,stripexif -f medium -r 80% -q 70 photo.jpg photo_output.jpg

Generated photo:

I think I'll add option to specify border color in the future!

-- hide signature --

Blog: haozhexu.me
Instagram: instagram.com/haozhe.xu

 HaoAndHui's gear list:HaoAndHui's gear list
Fujifilm X-Pro2 Panasonic Lumix DC-GX9 Panasonic Leica Summilux DG 25mm F1.4 Fujifilm XF 35mm F1.4 R Fujifilm XF 23mm F1.4 R +3 more
ForumParentFirstPrevious
Flat view
ForumParentFirstPrevious
Keyboard shortcuts:
FForum PPrevious NNext WNext unread UUpvote SSubscribe RReply QQuote BBookmark MMy threads
Color scheme? Blue / Yellow