New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish to Twitter: if a photo size>5MB, shrink before posting #710

Open
tantek opened this Issue Dec 2, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@tantek
Contributor

tantek commented Dec 2, 2016

Just as Bridgy Publish automatically shortens (ellipses) text content when posting to Twitter, it would be nice if Bridgy Publish could also detect when a photo being posted was too big for Twitter and resize it to be just under 5MB* (and then link to the original post for the full resolution version).

*Twitter photos must be <=5MB according to this actual error from Bridgy Publish logs:

2016-12-02 01:43:34.244510 W Error 400, response body: {"errors":[{"code":..."message":"Image file size must be <= 5242880 bytes"}]}

Photo being attempted to publish:

https://indieweb.org/images/f/fc/2016-335-hwc-sf.gif

@snarfed

This comment has been minimized.

Show comment
Hide comment
@snarfed

snarfed Dec 2, 2016

Owner

interesting idea! thanks for filing. resizing automatically seems like a minor liberty, but probably fine as long as we clearly document when and how it happens.

sounds like there's also some uncertainty around how Twitter handles animated gifs in particular? i guess that's orthogonal though. never mind!

the actual resizing would be straightforward, using either PIL or app engine's API: https://cloud.google.com/appengine/docs/python/images/

Owner

snarfed commented Dec 2, 2016

interesting idea! thanks for filing. resizing automatically seems like a minor liberty, but probably fine as long as we clearly document when and how it happens.

sounds like there's also some uncertainty around how Twitter handles animated gifs in particular? i guess that's orthogonal though. never mind!

the actual resizing would be straightforward, using either PIL or app engine's API: https://cloud.google.com/appengine/docs/python/images/

@snarfed snarfed added the publish label Dec 2, 2016

@snarfed

This comment has been minimized.

Show comment
Hide comment
@snarfed

snarfed Dec 2, 2016

Owner

re animated gifs, looks like they have extra limits on frames, etc:

https://dev.twitter.com/rest/media/uploading-media.html#gifrecs

... but 5MB limit is the same:

https://dev.twitter.com/rest/media/uploading-media.html#imagerecs

except maybe the limit is actually 3MB, not 5MB? from the link above:

The filesize limit above is enforced by the media upload endpoint. In addition, there is a separate product entity specific filesize limit which is applied when calling the Tweet creation (or similar) endpoints with media_id. For example, it is possible to upload a 5 MB image, but the Tweet creation requires images to be <= 3 MB. The filesize limit and other constraints may vary depending on the media_category parameter.

unfortunate, and confusing. @tantek this is begging for some empirical testing! eg can you POSSE a 4MB photo? :P

Owner

snarfed commented Dec 2, 2016

re animated gifs, looks like they have extra limits on frames, etc:

https://dev.twitter.com/rest/media/uploading-media.html#gifrecs

... but 5MB limit is the same:

https://dev.twitter.com/rest/media/uploading-media.html#imagerecs

except maybe the limit is actually 3MB, not 5MB? from the link above:

The filesize limit above is enforced by the media upload endpoint. In addition, there is a separate product entity specific filesize limit which is applied when calling the Tweet creation (or similar) endpoints with media_id. For example, it is possible to upload a 5 MB image, but the Tweet creation requires images to be <= 3 MB. The filesize limit and other constraints may vary depending on the media_category parameter.

unfortunate, and confusing. @tantek this is begging for some empirical testing! eg can you POSSE a 4MB photo? :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment