const PREVIEW_WIDTHS = [640, 960, 1280, 1600, 2048, 2600, 3200, 4096]; export function canvasImagePreviewWidth(width: number, maxWidth: number) { return Math.min(maxWidth, PREVIEW_WIDTHS.find(value => value >= width) || 4096); }