Images saving out as a LARGER file size than when uploaded?
Asked by Heather Zeman:

We place images in a Confluence page to hand-off to other internal teams. From there, that team can save the images in 3 ways:  

* Right click, save as
* Drag the image into a folder or desktop
* Click on the image and then hit the download button

However, we noticed with the first 2 options it's resulting in making the image file size**2-3 times larger** than the file we uploaded, which is a huge problem for ad-serving. The download button requires an extra step, so I have to wonder: *why is the file size fluctuating?*Can that be prevented? I would expect if I upload/insert a 200kb image, then no matter how it's saved out, it should remain 200kb or close to it. But we're seeing the file size increase to 700kb+. We are displaying the image full size (Original Size) when inserted into our Confluence template pages. Please help!


Answers:
author: Sarah Hutchings
body: Let me thank you for the really great question; I learned a lot on this google adventure.

So here is what is happening: Confluence's Gallery tool changes JPGs to PNGs for thumbnail display. I tested this issue with PNGs, and there was no file increase.

I found an existing ticket regarding this here: <https://jira.atlassian.com/browse/CONFSERVER-32957>.

I also found this really excellent stack overflow thread that explains this issue: [https://stackoverflow.com/questions/16636398/saving-jpg-to-png-increases-size#:\~:text=JPEG%20is%20a%20lossy%20compression,is%20better%20at%20compressing%20photos.](https://stackoverflow.com/questions/16636398/saving-jpg-to-png-increases-size#:~:text=JPEG%20is%20a%20lossy%20compression,is%20better%20at%20compressing%20photos.)

So possible solutions would be to use PNGs as there's no loss in the conversion or to keep using the download button, as this downloads original JPG that is stored on the server and not the resized PNG, which is then converted back into a JPG on download, keeping the larger PNG size.  

Once a file is converted to the larger PNG format, you can't shrink it back down to the lossy JPG format.

comments: author: Mykenna Cepek
body: You *can* delete older versions of the image files attached to a Confluence page. That can help eliminate those large files, if desired. Otherwise they'll just bloat your Confluence backups forever.

Uploading the smaller image file with the same filename (to the same Confluence page) creates a new version of the image, and replaces the image on the page. You must upload it with the exact same filename to accomplish this.

"Attachments \> View \> Upload" is the safest way to replace a file in this way.

Note that deleting prior images might break old versions of the page (depending on the timing between page edits and image uploads).


author: Mykenna Cepek
body: Sounds like a bug to me. If you can create "Steps to Reproduce" the problem, and maybe take a few screen shots to show what's not working right (e.g. resulting downloaded file sizes), that would make a great bug report:

<https://support.atlassian.com/contact/#/>

comments: author: Heather Zeman
body: I think that's going to be my best bet! I filmed a video walking through the issue and submitted a bug report, since I couldn't find any knowledge articles with the same issue. Thanks!!


author: Mykenna Cepek
body: Nice! Sorry about that whole bug thing tho.

If you could, please "Accept" my answer. I appreciate the "vote" for it, and doing the "Accept" thing is also wonderful. Thanks, best wishes!


Tags: cloud

confluence-cloud