It never fails. I spend hours building a nice graphic, post it to instagram, and their compression adds a ton of JPG artifacts destroying my nice clean look.
After a lot of testing, I was surprised by the results. There are a lot of articles about combatting instagram’s compression. Ends up, about everything I’d read has been wrong. For example, the most common rule of thumb is using a JPG source with 76% compression. Other sites recommend a fairly heavy compression to avoid Instagram’s dropping the compression hammer. That advice may have been good in the past (I don’t know) but it’s not now.
In this post, I’m doing a data driven deep dive to answer these questions:
- What is the best way to reduce Instagram’s compression?
- Is a large lossless PNG best? Or large JPG?
- Does Instagram penalize me for uploading a large full res image by applying extra heavy compression?
- What if I do the compression myself? Will Instagram still add compression to an already small image?
- Do fancy compressors like Tiny PNG and Kraken give a better result? (to be clear, they aren’t intended for this – I was just curious)
My Original Source Files
First off, I used 1080 x 1080 images. Other sites like the experts at Tailwind have already made it clear that your image should be 1080 wide by 608 to 1350 tall. Anything larger gets sized down.
To start, I created 2 images – a complex picture and a simple graphic. The picture has many colors and small details – a challenge for JPG compression. The graphic is easier to compress but the artifacts around the text can be more noticeable.
How I Analyzed The Files
I saved each picture into 16 different compressions (including pixel perfect png, 8-bit png, 12 levels of JPG, Kraken, and Tiny PNG). For the graphic, I saved 5 versions (PNG, GIF, JPG 0, 76, and 100).
Then I posted each to Instagram (using the iOS app) and downloaded the results for analysis:
- Similarity – how visually similar are the images? Here I went pixel by pixel and used the CIEDE2000 algorithm which is designed to work similar to the human eye. The scale is 0-100% where 100% means the file downloaded from Instagram looks exactly the same as my high res original.
- Exactness – how many pixels are exactly the same? For example, compression often looks very similar to the source file but has altered your colors by a few bits. This is bad if you’re trying to represent brand colors, etc. 75% means 75% of the pixels exactly match the source file.
- Checksum – is the resulting image exactly the same, unaltered file as what you uploaded? In other words, if I upload a small enough file then will instagram just use what I uploaded? It never was. Instagram always re-compresses the file.
In case you’re interested, I used NodeJS for the analysis using pngjs. Here’s my source code on GitHub.
After crunching the number for both the picture and the graphic, here are the results:
The most common myth you’ll see is to compress your image at 76% JPG before you upload to Instagram. It’s interesting that the 70 and 76 pre-compression winds up with the largest file sizes. I’m guessing people saw the same thing and assumed that translated to accuracy. 76 also did unexpectedly well on the exactness scale which is fascinating. But ultimately they didn’t perform best in similarity or exactness.
Ends up, your best bet is to upload an uncompressed PNG. Leave the compression to Instagram.
That’s a bummer since Instagram compression isn’t perfect. But if you try to get fancy with your own compression, you’re just making things worse.
More bad news is that the best scenario only matched 36% of the pixels of the source file. So don’t be surprised if that trademarked, committee approved color gets shifted by Instagram’s compression. In fact, even when I uploaded a pixel perfect GIF at 15kb, Instagram resaves it with JPG compression and doubles it’s size.
The takeaways are pretty simple:
- Your source image should be 1080 wide by 608 – 1350 tall
- Upload an un-compressed PNG
- Add any kind of lossy compression and you just make things worse