FixTweet / mosaic

A multi-image stitcher used by FixTweet written in Rust
MIT License
12 stars 3 forks source link

Image compositing crops images incorrectly when posting to Discord #4

Closed MStrohmeier closed 2 years ago

MStrohmeier commented 2 years ago

Steps to reproduce

  1. Pick a tweet with two images on it.
  2. Post it to Discord using any of the FixTweet domains
  3. Images are cropped horizontally in the Discord preview.

For example, this tweet shows two pictures of musical instruments. Note that the second picture shows both instruments are shown in full. The resulting image composition also shows both images in full, as expected.

However, in the Discord app, the image is cropped horizontally, such image image

The image dimensions being used by Discord have the wrong aspect ratio. The original image is 2106x590, which is an aspect ratio of roughly 7:2. The preview used by Discord is 1605x904, as it's forced to a 16:9 aspect ratio. It also zooms the image vertically, which is unexpected.

Antonio32A commented 2 years ago

This isn't an issue with mosaic really, since it produces a perfectly valid image. The worker is assuming the width and height (here) resulting in Discord resizing it. I've already created a PR (https://github.com/FixTweet/mosaic/pull/3) which adds a /size endpoint so the worker can fetch it from there.

Antonio32A commented 2 years ago

Fixed in https://github.com/dangeredwolf/FixTweet/pull/12.