fishcharlie / AirportStatusBot

This is a social media bot that will post delay information for airports in the United States.
MIT License
0 stars 0 forks source link

Bluesky Image Size Limitations #15

Closed fishcharlie closed 3 months ago

fishcharlie commented 4 months ago

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.

stucka commented 3 months ago

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.

fishcharlie commented 3 months ago

@stucka Great idea. Will try that out.

fishcharlie commented 3 months ago

Looks like this is resolved: https://bsky.app/profile/airportstatusbot.bsky.social/post/3kzuqiwxm5626

d5f54a5

Closing.