Cloudflare Transform Workers API downgrading image quality on resize

When I try to resize image via the worker, it resizes it on width and height, but downgrades image’s quality. I expect it to work as html image resizing without quality downgrade. What can I do for that?
5 Replies
Andrew
Andrew5mo ago
-
Chaika
Chaika5mo ago
Specify quality, the default is 85, you could set it to 100.
cf: {image: {quality: 100}}
Docs: https://developers.cloudflare.com/images/transform-images/transform-via-url/#quality
Cloudflare Docs
Transform via URL · Cloudflare Image Optimization docs
You can convert and resize images by requesting them via a specially-formatted URL. This way you do not need to write any code, only change HTML …
Andrew
Andrew5mo ago
i didn't mean to send this sorry
qwq6187
qwq61875mo ago
@Chaika setting is to 100 does not help, please check out that link https://i.chaika.me/cdn-cgi/image/width=300,quality=100,format=auto/https://i.chaika.me/e9ed1ae4adfe4c8d8ea938d1a3c7f67f where setting with to lower value downgrades quality too much(you can check this out by scaling image and compare it to image without resizing width explicitly)
Chaika
Chaika5mo ago
r, it resizes it on width and height, but downgrades image’s quality. I expect it to work as html image resizing without quality downgrade.
Sounds like you're confusing Browser scaling vs scaling the actual image. Browsers have their own scaling algorithms and I believe there's some situations too with scaling (ex: high dpi monitors/scaling settings where 300px of space is actually ~450px of pixels and thus a higher resolution image would look sharper then an exactly scaled image at the same resolution. You can serve different variants of an image using Image Resizing (480p, 720p, 1080p) which different sizes depending on the content, and take advantage of browsers which support more optimal image formats like webp instead of sending an always too large/wastefully large image at a suboptimal format for the web like png. Cloudflare Image Resizing can only operate off the image itself and resize it, you could also serve higher resolution images with worse quality to try to more optimally serve them
Want results from more Discord servers?
Add your server