Users report an image upload error when uploading large PNGs that need resizing to meet the max image size kb limit, resulting in a cryptic convert: improper image header error. The issue appears to stem from Discourse attempting to convert PNGs to JPEGs during resizing, which causes ImageMagick to fail due to incompatible operations. Users note that renaming the file to .jpeg bypasses the issue, and the error message is unhelpful. A discussion ensues about whether the client_max_body_size setting in nginx or apache might be involved, though it’s clarified that this is unrelated. The problem is resolved by adjusting the max image size kb setting, but users suggest a more user-friendly error message should be shown. The issue is traced to a bug in the image optimization pipeline where PNG-specific operations are applied to JPEGs. dan confirms the fix, which prevents the pipeline from misapplying operations and improves error handling.
It should be possible to increase that value by adding an upload_size parameter to your site’s app.yml file. See Change the maximum attachment/upload size for details.
I changed max image size kb to 500k and it uploaded, I wonder though if the error message shown to users should simply be something like “Upload failed: image size too large, please resize and try again”?
I can’t remember for sure now, but IIRC if you lower that setting and an uploaded image is larger than that, Discourse will attempt to resize the image to bring it down.
I think it’s tied to the png to jpg quality setting? It was a while ago now but I think Sam worked on the image resizer.
With regards to anyone who’d want to change it (or rather want smaller image sizes) I’d imagine any site where image quality is less important (so most sites apart from photography sites).
Quick search returned this - so looks like the resizer hasn’t been implemented yet (but I was sure it had )