A very common problem we have here is people who can't upload images because they are too big. StackExchange has a long-standing limit of 2 MB (I don't know if this is 2,000,000 or 2,097,152 bytes, but it doesn't make much difference. Typical smartphone images are at least twice this size, often much larger than that. While programmers and other relatively advanced computer users have no problem shrinking images using many different methods, your average user on a non-programming part of StackExchange, such as DIY, has no clue. Often all they know how to do is take a picture and "share" it.

The ideal solution would be for StackExchange to allow larger image upload, with automatic shrinking of files to the 2 MB limit. But I don't see that happening any time soon.

I have written a possible solution to this problem. I took some code I previously wrote (and still use) for converting images to PDFs (send the images in an email to [email protected] - go to https://picturepdf.com for details) and created a similar program for shrinking images. Using it is trivial - send the images in an email to [email protected] - go to https://picturepdf.com/shrink for details.

I am making no money off of this. Someday I might, if I figure out how. But for now - and the foreseeable future - this is another freebie.

  • Original images may be up to 15,000,000 bytes.
  • Images are shrunk so that the largest dimension is 1,500 pixels. If both dimensions are less than 1,500 pixels then the dimensions are unchanged.
  • Images are shrunk at least 50% based on filesize.
  • Images are shrunk to 1,500,000 bytes or less. (The exact size varies because of the JPEG compression algorithm, but figure somewhere between 1.4 and 1.5 Meg. typical.)
  • Images are sent back in the email and also provided as a link.
  • Original images and emails are erased from the server immediately.
  • Shrunk images are kept for user download via emailed link for 1 hour and then automatically deleted.

The link is provided because there are plenty of people (trust me on this) who can't figure out how to upload a file from email, depending on the email system they use (and other factors). Since SE allows paste-link-uploads, this provides a solution. But to avoid a bunch of problems (storage space, abuse of the system, etc.) I am limiting these links to (a) 1 hour lifetime and (b) 5 downloads.

Let me know what you think of this. (Based on description, or try it yourself.)

I am sure I tested this before, but today I had a picture to upload so I decided to eat my own dog food, and the link did not work. It worked separately in another browser tab, but not in the StackExchange paste link/image function. I uploaded the shrunken image from my computer and it worked fine. To be continued...


1 Answer 1


A little-known fact about JPEG is that quality is adjustable via its "Q" parameter which ranges from 1 to 10. This is chosen when the file is saved. The "Q" parameter dramatically affects the size of the file. Dramatically!

However, I do a lot of image processing (to hit size targets) - I've tried it every which way. The best way to get a usable photo at smaller file size is to reduce the JPEG "Q" value - NOT the resolution.

Here's an example. Good see how how the picture is marginal at 600px resolution but you can zoom into the 4000px original and see all you need? (at least with my eyes).

At Q=3 the picture is distorted at the per-pixel level if you zoom way in - but the abundance of pixels more than makes up for it in terms of seeing actual detail.

I am daily frustrated by people whose phones take Q=12 photos, they hit the 2MB limit, and react by smashing down the resolution Which utterly destroys the detail I need to see. The original resolution at Q=3 would be ideal but they don't know they can do that, or they don't have access to image software to let them "Save As...".

So I would suggest having your system try, as a first resort, to re-save the image as JPEG at full resolution but a lower Q such as 5 or 3. I think you'll be impressed.

To inform this conversation, take a look at this Q&A. The person came in with extremely large RAW images at 35Mpix resolution that they couldn't post. I pulled them down and converted to JPEG, at full resolution but lowest possible Q - literaly Q=0. Now, can you see (in the image) the wire size on that 20A breaker? That is why i argue for lowering Q not resolution. No way you would see that if the picture were squished to 1-2Mpix.

And yes, there are issues with some of the images, like high noise on the poorly lit ones, but they were in the originals and were not added by the Q smash. Really, this kind of thing is what JPEG was designed for.

  • Current algorithm is: If either dimension is > 1500, resize so largest to dimension is 1500. If size still larger than 1.5 Meg, change JPG quality starting at 99 and going down in increments of 2. This uses ImageMagick convert, which uses a quality scale of 1 to 100. The core problem (aside from a stupid limit in SE) is that the average non-technical user has absolutely no idea how to change quality setting in their phone and has even less of an idea how to edit a picture on their computer. They know how to send ("share") a picture by text/email/WhatsApp/etc. and that's about it. Commented Dec 30, 2022 at 3:09
  • @manassehkatz see my 2 new paragraphs, we got an example! :) Commented Feb 28, 2023 at 23:16
  • So looks like I should lower quality first, then size if needed. Wow: 12 megapixels in 324k. But I also have to revisit my code because there is something that I'm not doing right with the "paste link" option. Commented Mar 1, 2023 at 0:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .