{# canonical_base is the OWNING tenant's origin: all 16 Peasy domains serve the same catalogue, so a page rendered by a non-owner points its canonical at the owner instead of competing with it. Falls back to this site for static/self-owned pages. #}
🍋
Menu
Image

Aspect Ratio

Aspect Ratio (Width-to-Height Proportion)

Aspect ratio is the proportional relationship between an image's width and height, expressed as two numbers separated by a colon. Common ratios include 16:9 (widescreen), 4:3 (classic), and 1:1 (square).

Техническая деталь

Aspect ratio is calculated by dividing width and height by their greatest common divisor. Changing an image's aspect ratio without cropping requires adding padding or distorting the content.

Пример

```javascript
// Crop image to specific region
const canvas = document.createElement('canvas');
canvas.width = cropWidth;
canvas.height = cropHeight;
const ctx = canvas.getContext('2d');
ctx.drawImage(
  img,
  cropX, cropY, cropWidth, cropHeight,  // source rect
  0, 0, cropWidth, cropHeight            // dest rect
);
```

Связанные форматы

Связанные инструменты

Связанные термины