glitch-soc / mastodon

A glitchy but lovable microblogging server
https://glitch-soc.github.io/docs/
GNU Affero General Public License v3.0
689 stars 184 forks source link

Remove image dimension limits #1024

Open BenLubar opened 5 years ago

BenLubar commented 5 years ago

Pitch

There is no reason to limit image dimensions, especially when we are already limiting attachment file size. Remove the source image resizing code from the upload process. (The code is in two files, both named resize_image.js)

Motivation

  1. Currently the dimension limit is 12802 pixels.
    • Make a PNG that's 1280 by 1281 pixels of pixel art or something else with a limited palette that compresses well.
    • Alternatively, take a 1080p screenshot of some text.
  2. Upload this image.
  3. Note that the file size of the image that appeared is significantly higher, and also that the image that appeared is much blurrier than the source image.
rhaamo commented 5 years ago

That's the web frontend part resizing.

Removing it will just move the resizing part to the backend which IIRC currently allows up to 4096x4096.

Past this size any incoming picture just shows as a link...

So even removing the frontend resizing won't help much on full web page screenshot for example/long text.

BenLubar commented 5 years ago

Given the ubiquity of 1080p monitors, 1280x1280 is way too small. Even if the screenshots are from a 4K monitor, it's still 8 million pixels under the backend limit.

ClearlyClaire commented 5 years ago

Those limits are here for a purpose: pictures are always processed server-side with ImageMagick, which will likely allocate at least one buffer holding all the uncompressed pixels. This limit is at 4096×4096 pixels, after which media files will get ignored.

The resized limit of 1280×1280 may be a bit small indeed, we could definitely increase it.

BenLubar commented 5 years ago

maybe set the limit to equal the backend limit of 4096x4096? that's not something you're likely to run into (a 1080p full webpage screenshot could be 8738 pixels tall without hitting the pixel limit)