diff --git a/docs/api-resize.md b/docs/api-resize.md index 98aeab0e..799c5aa5 100644 --- a/docs/api-resize.md +++ b/docs/api-resize.md @@ -14,6 +14,8 @@ When both a `width` and `height` are provided, the possible methods by which the Some of these values are based on the [object-fit][1] CSS property. +Examples of various values for the fit property when resizing + When using a **fit** of `cover` or `contain`, the default **position** is `centre`. Other options are: * `sharp.position`: `top`, `right top`, `right`, `right bottom`, `bottom`, `left bottom`, `left`, `left top`. diff --git a/docs/image/api-resize-fit.png b/docs/image/api-resize-fit.png new file mode 100644 index 00000000..583c0ed4 Binary files /dev/null and b/docs/image/api-resize-fit.png differ diff --git a/lib/resize.js b/lib/resize.js index 33d98318..648ebef3 100644 --- a/lib/resize.js +++ b/lib/resize.js @@ -111,6 +111,8 @@ function isResizeExpected (options) { * * Some of these values are based on the [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) CSS property. * + * Examples of various values for the fit property when resizing + * * When using a **fit** of `cover` or `contain`, the default **position** is `centre`. Other options are: * - `sharp.position`: `top`, `right top`, `right`, `right bottom`, `bottom`, `left bottom`, `left`, `left top`. * - `sharp.gravity`: `north`, `northeast`, `east`, `southeast`, `south`, `southwest`, `west`, `northwest`, `center` or `centre`.