Resizing Images for a Twitter Stream (Shallow Thoughts)

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Thu, 17 Sep 2020

Resizing Images for a Twitter Stream

[LWVNM tweet of a Vote411 image] In the LWVNM, we're promoting our new non-partisan state-wide online Voter Guide, Vote411.

I got roped into doing the Twitter side of this, using a bunch of images the communications team got from the national LWV.

The problem is, the images are square, 1500x1500 pixels. Turns out Twitter won't display square images: according to most references I found, it crops any image you tweet to 600x335 (16:9).

So here I have all these images that don't make sense when people see them on their Twitter stream. So how do I add black borders so they'll be the right size to make Twitter happy?

I certainly don't want to edit 31 images (plus I expect there are eventually 31 more coming that will have Spanish captions).

Fortunately, there's ImageMagick. Here's how you convert a square image to some other size, filling the extra space with black:

convert -background black -gravity center input-image.jpg -resize 600x335 -extent 600x335 output-image.jpg

Thank goodness for labor saving command-line apps!

Tags: , ,
[ 14:13 Sep 17, 2020    More tech | permalink to this entry | ]

Comments via Disqus:

blog comments powered by Disqus