Resize images API

Try now

Docs

The structure of the API path is:

/api/imgresize/:width/:height/:url

Where width and height can be numbers in pixels or auto.

The URL should be URL encoded, which can be done in JS with encodeURIComponent. See MDN ref.

Example for https://memori.ai/logo.png:

https%3A%2F%2Fmemori.ai%2Flogo.png

Then call the API as, for example:

/api/imgresize/200/200/https%3A%2F%2Fmemori.ai%2Flogo.png

You can also specify a format using the querystring ?format= and indicating one of the following: avif, gif, heif, jpeg, jpg, jp2, pdf, png, svg, tiff, webp. Note: Experimental!

Another querystring parameter is ?fit= which can be one of the following: cover, contain, fill, inside, outside (Ref: sharp docs). Default is inside.