Allow exact fit in Cloudflare Image Resizing

Hi Team Cloudflare!

First let me state I’m very happy with the image resizing functionality, it saves on-server resizing or using third-party providers. Currently the image resizing allows three fitting modes, but I’m missing a way to specify an exact height and width, where the extra space will get filled up with a transparent color or a default white color (or perhaps user specified color).

Use case


Let’s say I have a bunch of logo’s and I’d like them all to be 300x300, but without cropping. Let’s take the site logo as example:


1749x195

Current methods


1. fit=scale-down w=300,h=300,fit=scale-down

Result:

image
300x33


2. fit=contain w=300,h=300,fit=contain

Result:

image
300x33


3. fit=cover w=300,h=300,fit=cover

Result:

image
300x300

Suggested new fitting mode


fit=exact w=300,h=300,fit=exact

Result being:

logo
300x300

I hope it’s clear why this would be a nice addition to the fitting modes and hope something like this can be implemented. Thanks for looking at my suggestion and keep up the good work!

Update

Looking at the documentation again, they’ve added the functionality now!

fit=pad w=300,h=300,fit=pad
Cloudflare

Great work, team Cloudflare!