X API image 5 MB limit: pick a Sume output format
X allows JPG, PNG, GIF and WEBP images up to 5 MB on every account. Sume outputs png, jpeg or webp, with no target file size field in the docs.

X accepts JPG, PNG, GIF and WEBP images of at most 5 MB for tweet_image and dm_image, and Premium does not raise that. Sume outputs png, jpeg or webp, but the docs pages I read list no target-file-size parameter, so you check the byte size of each file before upload.
The X spec is from its Media best practices page, read 2026-10-01. Sume facts are from Image API and Video frames.
What does X require for an image?
Supported types are JPG, PNG, GIF and WEBP, and the size must be 5 MB or less. The default and Premium tables both show 5 MB for images. Animated GIFs have a separate 15 MB limit.
| Category | Types | Max size |
|---|---|---|
tweet_image, dm_image | JPG, PNG, GIF, WEBP | 5 MB |
tweet_gif, dm_gif | Animated GIF | 15 MB |
Which output formats does Sume offer?
The image catalog lists output_format values of png, jpeg and webp. All three are on X's accepted list. Stills pulled from video with video-frames can be jpeg (the default) or png, with an optional max_edge clamp of 16 to 2160.
How do I keep a file under 5 MB?
The docs give size levers, not a byte target. For custom sizes on the GPT image model, both edges must be multiples of 16, the maximum edge is 3840, the aspect ratio at most 3:1, and the pixel count 655,360 to 8,294,400. A smaller image_size and a lossy format such as jpeg or webp tend to give smaller files, but the docs do not promise a size, so measure.
What should I do if a file is over the cap?
Regenerate at a smaller size or switch format, then check the size again before upload. If you upload via the chunked flow, follow the v2 upload steps. Images are checked again when attached to a Post.
Sources
Related posts
More in Developers
- X API media_category: tweet_video vs amplify_video vs dm_video
Pick media_category by destination: tweet_video for Posts, amplify_video for Ads, dm_video for DMs. Wrong category uploads fine and fails at Post create.
- X API media upload succeeded but the Post fails: two-stage checks
X enforces media limits at upload and again at POST /2/tweets, by the posting user. Here is a pre-flight list and what Sume's inspect and trim cover.
- X API paid_partnership true: disclose a sponsored AI video Post
Set paid_partnership true in POST /2/tweets to label a Post as paid promotion on X. Sume returns the video file; your own call creates and flags the Post.
- X API subtitles media_category: SRT sidecar vs burned-in captions
X lists `subtitles` as a media_category for sidecar files. Sume burns captions into the picture and does not take SRT uploads. Pick the path that fits.
Written by Sume