Skip to content

Commit efbb0c2

Browse files
committed
Docs: add image with examples of resize fit property
1 parent da0b594 commit efbb0c2

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

docs/api-resize.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ When both a `width` and `height` are provided, the possible methods by which the
1414

1515
Some of these values are based on the [object-fit][1] CSS property.
1616

17+
<img alt="Examples of various values for the fit property when resizing" width="100%" style="aspect-ratio: 998/243" src="https://cdn.jsdelivr.net/gh/lovell/sharp@main/docs/image/api-resize-fit.png">
18+
1719
When using a **fit** of `cover` or `contain`, the default **position** is `centre`. Other options are:
1820

1921
* `sharp.position`: `top`, `right top`, `right`, `right bottom`, `bottom`, `left bottom`, `left`, `left top`.

docs/image/api-resize-fit.png

16 KB
Loading

lib/resize.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ function isResizeExpected (options) {
111111
*
112112
* Some of these values are based on the [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) CSS property.
113113
*
114+
* <img alt="Examples of various values for the fit property when resizing" width="100%" style="aspect-ratio: 998/243" src="https://cdn.jsdelivr.net/gh/lovell/sharp@main/docs/image/api-resize-fit.png">
115+
*
114116
* When using a **fit** of `cover` or `contain`, the default **position** is `centre`. Other options are:
115117
* - `sharp.position`: `top`, `right top`, `right`, `right bottom`, `bottom`, `left bottom`, `left`, `left top`.
116118
* - `sharp.gravity`: `north`, `northeast`, `east`, `southeast`, `south`, `southwest`, `west`, `northwest`, `center` or `centre`.

0 commit comments

Comments
 (0)