Image compression and resizing

Very glad to learn that lowering the filesize limit on image uploads doesn’t restrict the uploading of the image and instead compresses the image below that size. I just lowered our limit to 1MB and would like to go down further. (We have lots of users in LatAm and not always the fastest connections)

Was just wondering, could the resizing function be configured for resizing the actual image resolution of the file? I just figure we’d get higher quality images if we were able to set a recommended image width for images. i.e. max width of 960 px (like Facebook) or 1024 px (like Twitter).


Yeah I can add a setting that will force all original images to be constraint to a maximum width. It will be faster than using the “automatic” algorithm which downsizes the image iteratively until it reaches the limit.

1 Like

Are you sure this matters? We automatically thumbnail any image that is wider than post width anyway so users are never seeing the original “giant” image unless they click through on the thumbnail…

I’ll see if I can do some tests and we can compare the quality.

My impression was that JPG compression has to discard more information on
larger sized images to lower the file size, and then you are using the
browser to resize the image resolution down. As opposed to actually
resizing the image, which in many cases may be sufficient to get the image
down to a reasonable size. My expectation is crisper images on the posts.

Happy to do the homework, if it’s something the Discourse team would
consider. Not sure what you guys are using to do the image processing, so I
don’t want to ask something that’s not included with the tool.

1 Like

No – we are actually resizing the image with the thumbnail. The only thing downloaded is the small thumbnail unless the user explicitly clicks or taps through on the image. Here’s a giant picture I just uploaded. Please feel free to verify this yourself if you don’t believe me.

OH! I didn’t realize that there were two images saved for each photo. Sorry about that @codinghorror, complete misunderstanding on my part. In that case, I’m going to bring my photo size down to 512KB. That’s still 5x of what FB or Twitter offer. I think it will be helpful in the long run.

Let’s see how this goes.

512kb? That’s tiny for a maximum image size. I am positive Facebook and Twitter don’t limit users to 102kb images!

Are you thinking of a different unit of measurement?

Agree with Jeff here, I don’t think there is much point in you lowering image size, the large images are only downloaded when people explicitly ask for them

By introducing an arbitrary restriction here you will encourage hotlinking and other hostile behaviours

Strongly recommend against

1 Like

Thinking about it, I think what you are after is a setting for “max image size displayed in topics” (for mobile and desktop separately)

I think that is a great feature req, but we do not have it quite yet


good thoughts @sam. keeping the image sizes in posts under 200KB (desktop) and 20KB (mobile) would probably be nice for our community, but I’m glad that the files are not over 1MB. I am pleased with the sizes I’m seeing.

@codinghorror, i downloaded a bunch of my FB images on my laptop. From the standard photo album they were around 100KB. When I went into full screen mode, I did find one at 480KB (looks like it had been resized to 2048 pixels wide). Note that 2048 pixels wide is the resolution for iPad retina display. It is possible that FB stores a larger version on their servers for the future.

I was just trying to be storage / cost conscious. I’ll boost back up to 1024 KB, but it will probably be difficult to bring it back down in the future. If our audience start uploading video, I guess that would be a whole other story :). In the end, I don’t really expect our users to be clicking through to see their images large. They use the photos more to decorate their topics, not to share single large images. But there are always different use cases.

Thanks for indulging on this topic :sunny: