Historically, Twitter has supported JPEG and PNG format images. Over the years, we’ve made improvements to our image pipeline moving towards faster load times while improving quality within reasonable constraints. Starting February 11th, we are going to extend this effort to better support users globally with how we handle uploaded images, with a focus on how we handle PNG images.
What are the changes being made?
The way Twitter handled PNG uploads in the past was not always consistent and could lead to large PNG images being used when a JPEG would have been preferable for image load latency and user data costs. The changes we’re making will provide consistent behavior that can be depended on by those uploading images to Twitter to reach a global audience by reducing how many PNG images are served on Twitter.
Why are these changes happening?
The reason for these changes is due to supporting a global audience. In the world of people wanting to participate on the internet, many can only access the internet at 2G speeds, and another large portion have slow or unreliable internet. The majority of people on the internet face constrained internet speeds, something that is entirely out of their control. One of the impacts of serving PNG images globally is that this majority internet user base are faced with large file downloads whenever they cross a Tweet with an embedded PNG, or even multiple PNGs. PNG images are most often between 6 and 9 times larger than their JPEG counterparts. The time to load a PNG vs a JPEG is maybe a few seconds where users can depend on reliable fast internet, but for most of the world it is many seconds of waiting. Waiting over 30 seconds is not uncommon and users either see a timeout or give up waiting.
The side effect of these PNGs being so large isn’t just that they load slowly. PNGs also take up bandwidth and slow everything else down. An isolated user loading a PNG will have to have their DMs and timeline and other features of Twitter compete with the PNG. On a wider scale, many users loading large PNG images on the same constrained networks will collectively add to bandwidth congestion on the network for all internet users, regardless of what apps they are using.
The open nature of Twitter as a platform means any Tweet can reach any person in the world. This is the core feature that Twitter provides. When a Tweet has unlimited reach, the impact of that reach needs more consideration for platforms that need to scale like Twitter does. To better support the needs of the global internet user base and fix what is currently broken for them, these changes are being made to reduce the impact that PNGs have on Twitter users and the internet.
What image categories are going to be impacted?
These changes will be applied to all images uploaded to Twitter.
What is the behavior going to be for uploaded JPEG images?
Uploaded JPEG images will remain in JPEG format, transcoded to 85% JFIF quality if the uploaded image has a higher quality. There’s really no change for what Twitter supports today.
What is the behavior going to be for uploaded WebP images?
Uploaded WebP images will all be converted to JPEG at 85% JFIF quality. The occasional conversion to PNG will no longer occur. WebP is will remain solely as a supported upload format, and Twitter will continue to not serve images as WebP.
What is the behavior going to be for uploaded PNG images?
PNG images are where there will be the most change and we want to detail the behavior clearly. There are actually numerous kinds of PNG formats and each needs to be considered. The change in behavior is going to move Twitter to converting more PNG images to be JPEG while offering a way to keep some PNG images as PNG as long as they meet criteria that has been set to achieve the image load performance needed at a global scale.
The simple breakdown is that lower color depth PNG images are encoded small enough to have better sizes than a JPEG counterpart, and we want to keep these PNG images. For high color depth PNG images, they are most often very large compared to a JPEG and delivering those images efficiently at a global scale is not feasible. For those high color PNG images, we will take extra steps to consider if we keep the PNG or, most likely, convert it to a JPEG.
Chart of breakdown:
|PNG||RGB Color w/ Alpha||RGB Color||Grayscale w/ Alpha||Grayscale||Palette Based|
|1 bit||n/a||n/a||n/a||Leave PNG||Leave PNG|
|2 bit||n/a||n/a||n/a||Leave PNG||Leave PNG|
|4 bit||n/a||n/a||n/a||Leave PNG||Leave PNG|
|8 bit||Test||Test||Test||Test||Leave PNG|
Which of those PNG formats are the most common?
The most common PNGs are PNG-24 and PNG-32. PNG-24 has RGB Color with 8 bit depth color, that is to say it uses 8 bits per channel with 3 color channels (RGB) for a total of 24 bits per pixel. PNG-32 has RGB Color w/ Alpha with 8 bit depth color, that is to say it uses 8 bits per channel with 3 color channels (RGB) plus an alpha channel for a total of 32 bits per pixel. Both PNG-24 and PNG-32 will be tested to consider if they will remain PNG or if they will be converted to JPEG, which is more likely.
A not so uncommon PNG format is PNG-8. PNG-8 is a Palette Based image with 8 bit depth color, that is to say it uses a palette to look up all of its colors and can support full RGB and Alpha color but has a maximum of 8 bits worth of colors, a.k.a. 256 colors in the palette. PNG-8 images will always stay as PNG-8 and won’t be converted.
What happens if I upload a PNG image that needs to be tested?
The test we apply to a high color depth PNG is that we will look at its file size and compare that to what it’s converted JPEG file size would be. If the PNG is sufficiently small enough based on a Twitter internal metric compared to the JPEG version, we will leave the PNG alone and use that. In the more common case, the PNG will be larger than our metric and will be converted to JPEG.
This testing is offered as a way for image creators to have the ability to construct and compress their PNG before upload to have a better chance at remaining a lossless quality PNG. This is going to be a rare case, but images dominated with solid colors have this potential so Twitter is taking the steps to support these PNG images.
The internal metric is currently going to be a straightforward file size comparison. The smaller file size between the PNG and the converted JPEG will be used. We may change this metric to support more nuance in the future if we identify ways to be more permissive for PNGs to not end up being converted.
Amendment 01/03/2019: In addition, if the image is a PNG that is 900 pixels or smaller in the longest dimension (can fit into 900x900), that PNG will be left as-is. See Amendment 01/03/2019: Preserving PNGs at low resolution for more.
What’s the advantage of supporting PNG-8 image?
The advantage of Twitter supporting PNG-8 images (also called 8-bit PNGs), is that images with a reduced color palette of 256 colors will now have a way to upload lossless quality images to Twitter that will be preserved unmodified. They are small enough to be as performant as JPEG or better, so there is less compromise with image artifacts from JPEG compression or large file sizes that PNG-24 and PNG-32 images can reach. PNG-8 also support alpha, so if transparency is desired, using part of the color palette to have transparent and semi-transparent pixels is an option.
What happens to images with transparency when converted to JPEG?
Images converted to JPEG that had transparency will have a white background applied.
What resolutions does Twitter support for images?
Twitter has different resolutions depending on the category of image.
|Profile Image (Avatar)||Profile Banner||DM Images||Tweet images (and all others)|
Where can I upload PNG and WebP images from?
Currently, you can upload PNG and WebP from:
- Tweetdeck for Mac
- Most 3rd party Twitter clients
- the Twitter API
- Twitter for Windows
Twitter for iOS converts all images to JPEG with 85% quality before upload.
Twitter for Android will upload WebP if posted unmodified; all other images (including WebP with any modifications made in the app) convert to JPEG with 85% quality before upload.
Amendment 01/03/2019: Preserving PNGs at low resolution
We’ve heard strong feedback to the proposed changes and want to continue supporting artists who use Twitter to share their work without risking theft or degradation of their work. For images that are low resolution but require maintaining a high quality, the test for PNG images will add the following change:
- If the image is a PNG that is 900 pixels or smaller in the longest dimension (can fit into 900x900), that PNG will be left as-is.
This compromise will yield a negative impact to load latencies for such images on timelines of users with slow internet, but will facilitate the needs of the artist community that do not wish to upload imagery at higher resolutions due to the risk of theft. Given the predominance of the issue we face with PNGs is high resolution images and not artwork that is low resolution, we believe this compromise can help both users with slow internet connections when they try to view Tweets with high resolution images, as well as artists who value high image quality when sharing their work on Twitter.
This amendment will be in place with the rest of the changes on February 11th with the caveat that it may be revisited as we monitor for abuse and potential adverse impact to Twitter users on slow connections.
If you have any questions, feel free to raise technical problems or concerns by replying to this post.
Thank you, and we look forward to seeing an even greater global reach for images on Twitter!
It was unwitting to call for feedback when Announcements are automatically locked. I’m sorry for that poor execution. A forum thread has been opened for feedback here:
Feedback for “Upcoming changes to PNG image support”
- Something the original announcement failed to adequately address was why these changes are happening, a Why are these changes happening? section has been added
- Frequent questions around image resolution support have come up, a What resolutions does Twitter support for images? section has been added
- Added a paragraph to increase clarity on the internal metric for deciding when to convert a PNG to JPEG or keep as a PNG
- The test for PNG images has been amended to afford preserving PNG images at low resolution. See Amendment 01/03/2019: Preserving PNGs at low resolution.
- This change has completed and is fully rolled out to all newly uploaded images to Twitter