According to DEV Community, a photo that fails a 10 MB upload limit is rarely a large file. It is a large decoded image. The author shot the same pair of shoes on the same phone and got a 12.4 MB PNG and a 240 KB JPEG. The PNG failed the upload. The JPEG passed.
The post separates two numbers. File size is what the network carries. Width times height times 4 is what the decoder allocates in memory. The author says a 6,000 by 4,000 PNG expands to roughly 96 MB of RGBA (red, green, blue and alpha, the transparency channel) data, whatever its compressed size. A noisy 4,000px JPEG at 3 MB can be slower to process than an 8 MB flat-lay on white.
The author suggests checking both numbers in the browser before upload. If the output is capped at 2048px on the long side, decoding anything larger is wasted work. The post says resizing on the client is worth it when the source is more than about 1.5 times the cap. It advises rounding once at the end to avoid a 1px skew, and never upscaling.
On formats, the post recommends WebP for web use, PNG only when transparency matters, and JPEG when a marketplace insists on .jpg. It warns that JPEG can nudge pure white corners to 254 or 253, which some automated checkers may call off-white.
The author also says a size limit is not a security control. The post recommends checking a file's magic bytes (the first bytes that identify its real type), setting a pixel budget when decoding, and re-encoding the output so hidden metadata does not survive. For ZIP uploads, it advises validating every entry first and reporting errors per file. It also says error messages should include numbers, such as the current size, the limit and the expected size after resizing.
Why it matters
If you accept image uploads from customers, staff or suppliers, a byte limit alone gives a poor picture of how heavy an image is to process. Pixel dimensions drive memory use and processing time, so a small file can still be costly and a large one can be cheap.
The post also points to practical gains for anyone running a store or catalogue. Resizing before upload saves time on batches, and a clear error message can cut support requests. Re-encoding images is a simple way to strip metadata such as GPS data. Check marketplace rules for backgrounds too, since near-white may not pass.
Source: DEV Community. This brief summarises their reporting; read the original for the full detail.