fishcharlie / AirportStatusBot

This is a social media bot that will post delay information for airports in the United States.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bluesky Image Size Limitations

fishcharlie opened this issue · comments

Every once in a while an image that is able to be posted on Mastodon fails on Bluesky due to image size limitations.

We should think about how to fix this.

This might be like six lines of code if the async promises garbage plays nice?

Take the existing ImageGenerator class, rename it, and have it return a buffer, not a file.

Build a wrapper ImageGenerator class that calls the original, evaluates the length of the buffer, determines if it's over 1mb, if so calls jimp to scale at 70% and gets you a new buffer, then whatever the final buffer is gets the same return as what's in place now ... ?

If it's marginal now, a 70% rescale should cut the file size in half and always get you over the finish line. Your dimensions both multiply evenly by .7.

@stucka Great idea. Will try that out.