loading

Product images

A catalogue needs the same photo at half a dozen sizes, on a consistent background, cropped the same way every time. One upload produces the whole set here, in a single pass, before anything is sent anywhere.

Try it

Recipe

Applied behind transparent pixels and in the padding, so every tile matches.
Sizes

One source, many outputs

Fit rather than Cover: a product must never be cropped, so it is scaled to fit the padded area and centred on an ImageCanvas filled with the catalogue background. (ResizeMode.Contain pads too, but it fits to the full canvas first - fine for a letterbox, wrong for a margin.) Each size is a separate run against pixels that were decoded once, which is the expensive part.

C#
// Fit, never Cover: a product must never be cropped. It is scaled to fit the// padded area and centred on a canvas of the catalogue background.foreach (var size in sizes){    var inner = (int)(size * (1 - padding * 2));    using var fitted = await ImagePipeline.Create()        .AutoOrient()        .Resize(inner, inner, ResizeMode.Fit)        .Sharpen(0.25f)        .ExecuteAsync(decodedOnce);​    using var canvas = ImageCanvas.Create(size, size, catalogueBackground);    canvas.DrawImage(fitted, new RectangleF(        (size - fitted.Width) / 2f, (size - fitted.Height) / 2f, fitted.Width, fitted.Height));​    using var variant = canvas.Snapshot();    results.Add(await exporter.EncodeAsync(variant, exportOptions));}
An unhandled error has occurred. Reload 🗙