I know it seems on the surface like “just resize it” is a good approach, but it’s not super uncommon to see quite extreme aspect images, and even for normal use there are lots of different constraints in different systems that mean a really simple system can produce undesirable results.
I used to get this all the time back when I built custom content management systems. Users would upload images which were automatically cropped into various sizes for use in particular bits of content; really long or wide images would look awful when scaled, and automatic fixed-size crops would often end up cutting out the actual interesting bit of the image. That’s what various “automatically generate interesting thumbnails” algorithms try to avoid.
In the end for me the best tool was auto-crop-with-preview-and-manual-override, and I’m beyond infuriated every time I try to upload an image to Twitter and it doesn’t allow this obvious and simple way to avoid the issue.
I’ve never seen the Twitter-dot-com codebase but would be willing to bet it’s probably using VIPS’ smartcrop feature (:crop => :attention) https://www.rubydoc.info/gems/ruby-vips/Vips/Interesting