You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When testing out the media endpoint added in #700, I noticed that images I'd already processed through https://squoosh.app/ (e.g. this photo) were getting saved with a larger file size than the original. It's probably due to some extra optimization that aren't on by default in Sharp, but it seems like an opportunity for improvement.
Describe the solution you’d like
A file size check before accepting a processed image over the original
The downside of the file size check is that it could potentially lead to EXIF data unexpectedly not being removed and exposing location data. The Sharp JPEG encoding options could be exposed, though I'm not sure if always using that option would cause Sharp to always output jpeg format (even for PNGs).
Describe alternatives you’ve considered
I'm using a fork of the media endpoint code with some modifications to fix the issues I noticed. I have some logic about jpeg quality that probably is unique to my site, but otherwise the code could be a reference point for implementation.
Is your feature request related to a problem?
When testing out the media endpoint added in #700, I noticed that images I'd already processed through https://squoosh.app/ (e.g. this photo) were getting saved with a larger file size than the original. It's probably due to some extra optimization that aren't on by default in Sharp, but it seems like an opportunity for improvement.
Describe the solution you’d like
The downside of the file size check is that it could potentially lead to EXIF data unexpectedly not being removed and exposing location data. The Sharp JPEG encoding options could be exposed, though I'm not sure if always using that option would cause Sharp to always output jpeg format (even for PNGs).
Describe alternatives you’ve considered
I'm using a fork of the media endpoint code with some modifications to fix the issues I noticed. I have some logic about jpeg quality that probably is unique to my site, but otherwise the code could be a reference point for implementation.
https://github.com/aciccarello/ciccarello-indiekit/blob/3381efe087a99b4ceaed44af2bf8f80ca79e52a8/lib/endpoint-media/lib/media-transform.js#L14-L31
Additional context
On my site, images usually are shown with a max with of 1024, so I will often upload a 2048px wide image with lower jpeg quality for high DPI screens.
The text was updated successfully, but these errors were encountered: