Resize images API
Docs
Resize API
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.
Convert API
Convert images between different formats:
/api/convert/:format/:url
Where format is the target format (e.g., png, jpeg, webp, etc.) and url is the URL-encoded source image URL.
Supported formats: avif, gif, heif, jpeg, jpg, jp2, pdf, png, svg, tiff, webp
Example: Convert a HEIC image to PNG:
/api/convert/png/https%3A%2F%2Fexample.com%2Fimage.heic