Assets change image format via url

is there any way to get an image in a specific format on the fly (i.e. like we can do to resize the image via the asset URL using query strings)?

You can use format=WebP or use auto=true to use the best supported format:

Here are a list of all parmeters:

1 Like

Thanks, @Sebastian for the prompt reply. Just did some tests and it’s working. For some reason, if the source asset format is in WEBP, &format=PNG works but not to JPG. Is that by design?

Perhaps because transparency or something like this? Can you give me an example?

there was no transparency…

attached pic

https://i.postimg.cc/FKHX3bGV/Manifold-Gunk-558x460-4.webp

I mean do you have an example URL to your squidex instance where you make the resize.

https://rycocms.azurewebsites.net/api/assets/rycodev/874a04b8-af1c-4fa8-9b97-81c12fd107bb/

Works for me: https://rycocms.azurewebsites.net/api/assets/rycodev/874a04b8-af1c-4fa8-9b97-81c12fd107bb/?format=JPEG

1 Like

oh my mistake i was doing JPG… :roll_eyes:

1 Like

Quick follow up on auto=true. Will this work when setting the cache parameter as well?

In other words if I was displaying an image with auto=true and cache=8640000 would I be served a cached webp image in a browser like chrome and a cached png/jpg in a browser that didn’t support webp, or would it just render the auto choice on the initial cache only and try to serve the same thing in both browsers?

The cache parameter just sets the output cache for the browser. So the image is cached client side, not server side. So each client should get the correct format.

1 Like