Lee este artículo en español.
How to convert images to WebP automatically
A site loads slowly almost always for the same reason: the photos people upload weigh several megabytes uncompressed. It usually comes down to one of these:
- Photos uploaded straight from a phone: modern cameras produce several-MB JPEGs without anyone touching them.
- Images meant for print or shot on a professional camera, at a resolution far higher than the site will ever display.
- A form or CMS that stores the image exactly as it arrives, without resizing or compressing it.
- Hundreds of product photos piled up, each one heavier than it needs to be.
The result: the site takes a while to load, especially on mobile, and that hurts both the user experience and SEO. Fixing it by hand (opening each photo, resizing it, exporting it as WebP) works for a single image, but not when there are hundreds, or when people keep uploading new ones every day.
Convert and resize in the same step
With Resize, convert and compress images you send the image as-is (as PNG, JPEG, WebP, AVIF, GIF or TIFF) in the request body itself, or as JSON in base64, and ask for at least one of these: width and/or height (between 1 and 8000 pixels), an output format, or a quality level. If you only give the width, the height adjusts itself to keep the proportions (the image never comes out distorted), and if you don't specify a format, it keeps the input format: you can resize without converting, or convert without resizing.
Without cropping or distorting what you don't want to
When you ask for width AND height at the same time, how the image fits into that exact box comes into play. By default it uses the fit that never crops or distorts anything (it shrinks the whole image to fit inside those dimensions); if instead you need the image to fill the exact box with no empty space (say, for a grid of thumbnails that all need to measure the same), you can ask it to crop whatever doesn't fit instead of leaving blank space.
WebP, quality and final file size
WebP usually weighs quite a bit less than an equivalent JPEG or PNG, while keeping a similar level of quality to the eye, which is why it's the most common conversion for speeding up a site. You can adjust the compression quality (between 1 and 100); if you don't specify anything, it defaults to 80 for both JPEG and WebP, and 50 for AVIF. PNG works differently: if you don't specify quality, the conversion is lossless, so the file is heavier but keeps every pixel exact.
How the result comes back
By default the result follows the same mode as the input: if you sent the image as binary, it comes back as binary; if you sent it inside a JSON, it comes back inside a JSON with the image in base64. If you need the opposite, you can force it with output=image, output=binary or output=json. Every call, regardless of the input or output size, costs 1 credit.
FAQ
Do I need to specify every parameter at once? No, just one is enough: width/height, fit, format or quality. If you don't touch the format, the image keeps its input format.
Can I convert to WebP without changing the size? Yes, just request the format (webp) without touching width or height, and the image converts while keeping its original dimensions.
What happens if I only give the width and not the height? The height is calculated automatically to keep the original proportions. The image never comes out stretched or squashed.
How much does it cost to process an image? 1 call = 1 credit, regardless of the input or output image size.
Try these tools
You'll find the full instructions for Resize, convert and compress images, with examples for n8n, Make and your own code. And if you don't have an account yet, you can create one for free.