mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Docs: fix affine interpolator example
This commit is contained in:
parent
8408e99aa3
commit
bf9bb56367
@ -93,7 +93,7 @@ Perform an affine transform on an image. This operation will always occur after
|
|||||||
|
|
||||||
You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
||||||
By default, new pixels are filled with a black background. You can provide a background color with the `background` option.
|
By default, new pixels are filled with a black background. You can provide a background color with the `background` option.
|
||||||
A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolator` Object e.g. `sharp.interpolator.nohalo`.
|
A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolators` Object e.g. `sharp.interpolators.nohalo`.
|
||||||
|
|
||||||
In the case of a 2x2 matrix, the transform is:
|
In the case of a 2x2 matrix, the transform is:
|
||||||
- X = `matrix[0, 0]` \* (x + `idx`) + `matrix[0, 1]` \* (y + `idy`) + `odx`
|
- X = `matrix[0, 0]` \* (x + `idx`) + `matrix[0, 1]` \* (y + `idy`) + `odx`
|
||||||
@ -127,7 +127,7 @@ where:
|
|||||||
const pipeline = sharp()
|
const pipeline = sharp()
|
||||||
.affine([[1, 0.3], [0.1, 0.7]], {
|
.affine([[1, 0.3], [0.1, 0.7]], {
|
||||||
background: 'white',
|
background: 'white',
|
||||||
interpolate: sharp.interpolators.nohalo
|
interpolator: sharp.interpolators.nohalo
|
||||||
})
|
})
|
||||||
.toBuffer((err, outputBuffer, info) => {
|
.toBuffer((err, outputBuffer, info) => {
|
||||||
// outputBuffer contains the transformed image
|
// outputBuffer contains the transformed image
|
||||||
|
2
lib/index.d.ts
vendored
2
lib/index.d.ts
vendored
@ -356,7 +356,7 @@ declare namespace sharp {
|
|||||||
* Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
|
* Perform an affine transform on an image. This operation will always occur after resizing, extraction and rotation, if any.
|
||||||
* You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
* You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
||||||
* By default, new pixels are filled with a black background. You can provide a background color with the `background` option.
|
* By default, new pixels are filled with a black background. You can provide a background color with the `background` option.
|
||||||
* A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolator` Object e.g. `sharp.interpolator.nohalo`.
|
* A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolators` Object e.g. `sharp.interpolators.nohalo`.
|
||||||
*
|
*
|
||||||
* In the case of a 2x2 matrix, the transform is:
|
* In the case of a 2x2 matrix, the transform is:
|
||||||
* X = matrix[0, 0] * (x + idx) + matrix[0, 1] * (y + idy) + odx
|
* X = matrix[0, 0] * (x + idx) + matrix[0, 1] * (y + idy) + odx
|
||||||
|
@ -114,7 +114,7 @@ function flop (flop) {
|
|||||||
*
|
*
|
||||||
* You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
* You must provide an array of length 4 or a 2x2 affine transformation matrix.
|
||||||
* By default, new pixels are filled with a black background. You can provide a background color with the `background` option.
|
* By default, new pixels are filled with a black background. You can provide a background color with the `background` option.
|
||||||
* A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolator` Object e.g. `sharp.interpolator.nohalo`.
|
* A particular interpolator may also be specified. Set the `interpolator` option to an attribute of the `sharp.interpolators` Object e.g. `sharp.interpolators.nohalo`.
|
||||||
*
|
*
|
||||||
* In the case of a 2x2 matrix, the transform is:
|
* In the case of a 2x2 matrix, the transform is:
|
||||||
* - X = `matrix[0, 0]` \* (x + `idx`) + `matrix[0, 1]` \* (y + `idy`) + `odx`
|
* - X = `matrix[0, 0]` \* (x + `idx`) + `matrix[0, 1]` \* (y + `idy`) + `odx`
|
||||||
@ -131,7 +131,7 @@ function flop (flop) {
|
|||||||
* const pipeline = sharp()
|
* const pipeline = sharp()
|
||||||
* .affine([[1, 0.3], [0.1, 0.7]], {
|
* .affine([[1, 0.3], [0.1, 0.7]], {
|
||||||
* background: 'white',
|
* background: 'white',
|
||||||
* interpolate: sharp.interpolators.nohalo
|
* interpolator: sharp.interpolators.nohalo
|
||||||
* })
|
* })
|
||||||
* .toBuffer((err, outputBuffer, info) => {
|
* .toBuffer((err, outputBuffer, info) => {
|
||||||
* // outputBuffer contains the transformed image
|
* // outputBuffer contains the transformed image
|
||||||
|
Loading…
x
Reference in New Issue
Block a user