payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
24.67k stars 1.56k forks source link

Original image not preserved when imageSizes key is set (filesize difference) #7465

Open sdjnes opened 2 months ago

sdjnes commented 2 months ago

Link to reproduction

https://github.com/sdjnes/payload-png-bug

Describe the Bug

An Upload collection that accepts images does not preserve the original image when imageSizes key is present, even when formatOptions is not set.

Sometimes file size is larger when uploaded, other times smaller

This is most apparent with PNGs because the file sizes seem to vary a lot. This also occurs with JPEGs, but the filesize difference is minimal.

Without imageSize key (size is correct) image

With imageSize key (size is incorrect in Payload) image

Payload is not misreporting the filesize - the original image has been modified. If you download, it indeed has the 895KB filesize.

To Reproduce

Payload Version

Observed on 2.22 and 2.25

Adapters and Plugins

None

JarrodMFlesch commented 2 months ago

Here is a sample image for testing - leaving this here for the team. Original size is 706 KB, uploads as 906 KB.

sample-image