# Images are still too big -- how to compress further?

**URL:** <https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836>\
**Category:** Support\
**Created:** [September 28, 2016, 11:36pm UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836 "2016-09-28T23:36:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)\
**Post date:** [September 28, 2016, 11:36pm UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/1 "2016-09-28T23:36:52Z")

</div>

Images that are uploaded from smartphones are commonly over 4MB in size (my max upload size is set to 5MB). I just took one of these images are dumped it into [ImageOptim](https://imageoptim.com/mac) and the size dropped to under 800KB. I can’t tell the difference when viewing the pics.

 ![](https://global.discourse-cdn.com/meta/original/3X/4/d/4dd5fe516c457d1fcc33606c9b02cb5c71e60912.jpeg)

Is there any way to have something like this done on my forum automagically?

---

<div class="post-metadata">

**Author:** ![charles](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@charles](https://meta.discourse.org/u/charles)\
**Post date:** [September 29, 2016, 2:24am UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/2 "2016-09-29T02:24:30Z")

</div>

4.2MB and compressed to 759KB without making quality suffer?

That’s impressive since even Google can’t even do that

---

<div class="post-metadata">

**Author:** ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)\
**Post date:** [September 29, 2016, 3:08am UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/3 "2016-09-29T03:08:35Z")

</div>

It’s not impressive, but that’s besides the point. I’m simply asking if there’s a solution or some kind of work around. I tried lowering the allowable upload max image size, but then users can’t upload images from mobile devices at all (“your file is too big, yadda yadda”).

**4MB image sizes are simply unnecessary.**

---

<div class="post-metadata">

**Author:** ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)\
**Post date:** [September 29, 2016, 3:10am UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/4 "2016-09-29T03:10:03Z")

</div>

I’m very interested as well!

I though though that images get resized/compressed after initial upload, so you can even allow e.g. 10MB uploads, but limit max image width/height dimensions in your Settings.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [September 29, 2016, 5:16pm UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/5 "2016-09-29T17:16:52Z")

</div>

There is some support for this @zogstrip can elaborate as he has time.

---

<div class="post-metadata">

**Author:** ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)\
**Post date:** [November 10, 2016, 9:46pm UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/6 "2016-11-10T21:46:20Z")

</div>

> [@codinghorror](#):
>
> There is some support for this @zogstrip can elaborate as he has time.

Hey @zogstrip have you had time to look into this?

---

<div class="post-metadata">

**Author:** ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)\
**Post date:** [November 10, 2016, 9:59pm UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/7 "2016-11-10T21:59:30Z")

</div>

There is definitely demand for further compression / pixel size limiting after upload.

Imho it should be allowed to upload big files but optimize / downsize them on the server after upload based on parameters from admin config.

Specifically for mobile uploads it would be beneficial to downsample them while keeping high quality / low compression (then to keep high res and compress photo with loss). Phone lenses are very low quality and even that there is high megapixel (usually it is just marketing) chip it doesn’t have any more pixel information than reasonably downsized photo.

> [@Would it be worth resizing uploaded images (to save space)?](https://meta.discourse.org/t/would-it-be-worth-resizing-uploaded-images-to-save-space/51901):
>
> My backup is getting bigger and bigger, and the bulk of it is uploaded images. Most of the images posted on the forum are of things like screengrabs or other images where the highest quality is not critical. Really large images are rarely needed too (users are often lazy and don’t always resize before uploading). Anyone else think we need some sort of option when it comes to the size of uploaded images? Perhaps we can set dimensions in the ACP and images are resized and at a quality level we s…

---

<div class="post-metadata">

**Author:** ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)\
**Post date:** [November 10, 2016, 10:17pm UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/8 "2016-11-10T22:17:35Z")

</div>

> [@Overgrow](#):
>
> There is definitely demand for further compression / pixel size limiting after upload.

Yes. For example, for our non-commercial community it tends to become vital. Every cent counts when no one is sponsoring… How much money we spend on the server, it mostly depend on how much space our current $20/mo DigitalOcean instance still have.

---

<div class="post-metadata">

**Author:** ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)\
**Post date:** [November 10, 2016, 11:20pm UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/9 "2016-11-10T23:20:21Z")

</div>

Exactly.. from my experience fast access drives (15k SAS HDD or SSD) have always been biggest factor to server operating cost.

---

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [May 22, 2017, 12:50pm UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/10 "2017-05-22T12:50:50Z")

</div>

FYI: I recently re-worked our upload pipeline, which includes auto-converting large PNGs into (very) small JPEGs. You can fine tune the quality of the JPEGs with the “`png to jpg quality`” site setting.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [May 22, 2017, 9:59pm UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/11 "2017-05-22T21:59:58Z")

</div>

The paint point here was very large uploaded PNGs which had absolutely no business being lossless PNGs, when they could be lossy JPGs at 1/5 or less the size. For small images (1280x720 or less) it does not matter so much, but get to 1080p++ and the cost becomes .. extreme.

```
1,651,936 Screenshot_2017-04-16-21-23-50.png
1,701,243 Screenshot_2017-04-16-21-23-54.png

  323,789 Screenshot_2017-04-16-21-23-50.jpg
  288,995 Screenshot_2017-04-16-21-23-54.jpg

```

This also has super bad ramifications for PNG optimizers which take n2 or worse time as the image gets larger.. here’s `pngout.exe` behavior by image size:

```
960x540
s1 → 2.1s
s2 → 2.2s

1280x720 (720p)
s1 → 3.7s
s2 → 3.2s

1920x1080 (1080p)
s1 → 32s
s2 → 33s

3840x2160 (4k)
s1 → 57s
s2 → 42s

```

---

<div class="post-metadata">

**Author:** ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)\
**Post date:** [May 22, 2017, 10:08pm UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/12 "2017-05-22T22:08:04Z")

</div>

Yeah, larger res PNG’s are way bigger than JPEG’s. I am considering removing PNG’s from the approved files list; do any smartphones use PNG as the native capture format?

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [May 22, 2017, 10:10pm UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/13 "2017-05-22T22:10:50Z")

</div>

You shouldn’t need to worry, latest version of Discourse handles this perfectly and seamlessly. If Bad Users upload giant PNGs we auto-force-convert them as needed.

---

<div class="post-metadata">

**Author:** ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)\
**Post date:** [August 27, 2017, 1:42pm UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/14 "2017-08-27T13:42:52Z")

</div>

BTW, how large is considered _giant_?

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [August 28, 2017, 3:17am UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/15 "2017-08-28T03:17:44Z")

</div>

Look in your site settings for the image related settings.

---

<div class="post-metadata">

**Author:** ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)\
**Post date:** [August 28, 2017, 4:54am UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/16 "2017-08-28T04:54:12Z")

</div>

Sorry to be a pest, but the only image relevant settings I can find are `max image size` and `max image megapixels`.

Are you saying that pngs larger than `max image megapixels` will be converted to jpegs?

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [August 28, 2017, 5:26am UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/17 "2017-08-28T05:26:04Z")

</div>

This is something you can pretty easily test for yourself on [https://try.discourse.org](https://try.discourse.org) – give it a shot!

---

<div class="post-metadata">

**Author:** ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)\
**Post date:** [February 16, 2019, 11:18pm UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/18 "2019-02-16T23:18:12Z")

</div>

I know that it is probably not recommended approach, but I’d like to batch downsize uploads directory (original uploaded images not thumbnails) with external utility from bash. I’ve noticed that there is filesize column in uploads table so the question is: should I care about updating filesize field for each uploaded file that I’ll optimize outside of Discourse? Can I break something if not? From what I’ve found in sources uploads.filesize field is only used to display information in lightbox to user.

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [February 16, 2019, 11:35pm UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/19 "2019-02-16T23:35:38Z")

</div>

We need a proper custom script to do that, cause sha1 also should be updated and posts should be rebaked, optimized images need to be redone, it’s a pretty involved process

---

<div class="post-metadata">

**Author:** ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)\
**Post date:** [February 17, 2019, 8:53am UTC](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836/20 "2019-02-17T08:53:43Z")

</div>

OK, thanks! I know I’ve forgot something.. I will look into it more in detail..

[Next page](https://meta.discourse.org/t/images-are-still-too-big-how-to-compress-further/50836.md?page=2)
