14

Resizing Images for a Twitter Stream (Shallow Thoughts)

 4 years ago
source link: https://shallowsky.com/blog/tech/convert-images-for-twitter.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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: ImageMagick, twitter, cmdline
[ 14:13 Sep 17, 2020    More tech | permalink to this entry | ]


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK