Replace/modify how payload resize/convert images #899
Replies: 3 comments
-
Sorry to bump, really appreciate any ideas or thoughts. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hey @khakimvinh — just so I am clear, the main thing you're looking to change is to disable the way that small images are upscaled to the larger size. Is that correct? Building in hooks here may not be the best way to do this. We might consider adding an option for Should we support this internally? We would be happy to accept a PR if you agree with this approach, and I could talk through implementation strategy as well! |
Beta Was this translation helpful? Give feedback.
-
Hi @jmikrut thanks for the reply. I just found below in the payload source code // line 50
const sizes = imageSizes
.filter((desiredSize) => desiredSize.width <= dimensions.width || desiredSize.height <= dimensions.height)
... So we actually already have code to prevent unnecessary up-scaling. The thing is the code doesn't check if Also, there is a line in the doc: If such feature not exists yet, I can try to do a PR on:
Let me know what you think, thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I would like to modify how payload resize and convert images, is there a way to do so?
The reason:
imageSizes
, if uploaded media smaller, it will get enlarged.What I checked:
Current work around I can think of is using payload-webp then use after change hook to remove files resized by payload.
Any ideas appreciated, thanks.
Beta Was this translation helpful? Give feedback.
All reactions