You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/content/docs/api-constructor.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ where the overall height is the `pageHeight` multiplied by the number of `pages`
33
33
34
34
| Param | Type | Default | Description |
35
35
| --- | --- | --- | --- |
36
-
|[input]| <code>Buffer</code> \| <code>ArrayBuffer</code> \| <code>Uint8Array</code> \| <code>Uint8ClampedArray</code> \| <code>Int8Array</code> \| <code>Uint16Array</code> \| <code>Int16Array</code> \| <code>Uint32Array</code> \| <code>Int32Array</code> \| <code>Float32Array</code> \| <code>Float64Array</code> \| <code>string</code> || if present, can be a Buffer / ArrayBuffer / Uint8Array / Uint8ClampedArray containing JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image data, or a TypedArray containing raw pixel image data, or a String containing the filesystem path to an JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image file. JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF or raw pixel image data can be streamed into the object when not present. |
36
+
|[input]| <code>Buffer</code> \| <code>ArrayBuffer</code> \| <code>Uint8Array</code> \| <code>Uint8ClampedArray</code> \| <code>Int8Array</code> \| <code>Uint16Array</code> \| <code>Int16Array</code> \| <code>Uint32Array</code> \| <code>Int32Array</code> \| <code>Float32Array</code> \| <code>Float64Array</code> \| <code>string</code> \| <code>Array</code>||if present, can be a Buffer / ArrayBuffer / Uint8Array / Uint8ClampedArray containing JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image data, or a TypedArray containing raw pixel image data, or a String containing the filesystem path to an JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image file. An array of inputs can be provided, and these will be joined together. JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF or raw pixel image data can be streamed into the object when not present. |
37
37
|[options]| <code>Object</code> || if present, is an Object with optional attributes. |
38
38
|[options.failOn]| <code>string</code> | <code>"'warning'"</code> | When to abort processing of invalid pixel data, one of (in order of sensitivity, least to most): 'none', 'truncated', 'error', 'warning'. Higher levels imply lower levels. Invalid metadata will always abort. |
39
39
|[options.limitInputPixels]| <code>number</code> \| <code>boolean</code> | <code>268402689</code> | Do not process input images where the number of pixels (width x height) exceeds this limit. Assumes image dimensions contained in the input metadata can be trusted. An integral Number of pixels, zero or false to remove limit, true to use default limit of 268402689 (0x3FFF x 0x3FFF). |
@@ -74,6 +74,13 @@ where the overall height is the `pageHeight` multiplied by the number of `pages`
74
74
|[options.text.rgba]| <code>boolean</code> | <code>false</code> | set this to true to enable RGBA output. This is useful for colour emoji rendering, or support for pango markup features like `<span foreground="red">Red!</span>`. |
75
75
|[options.text.spacing]| <code>number</code> | <code>0</code> | text line height in points. Will use the font line height if none is specified. |
76
76
|[options.text.wrap]| <code>string</code> | <code>"'word'"</code> | word wrapping style when width is provided, one of: 'word', 'char', 'word-char' (prefer word, fallback to char) or 'none'. |
77
+
|[options.join]| <code>Object</code> || describes how an array of input images should be joined. |
78
+
|[options.join.across]| <code>number</code> | <code>1</code> | number of images to join horizontally. |
79
+
|[options.join.animated]| <code>boolean</code> | <code>false</code> | set this to `true` to join the images as an animated image. |
80
+
|[options.join.shim]| <code>number</code> | <code>0</code> | number of pixels to insert between joined images. |
81
+
|[options.join.background]| <code>string</code> \| <code>Object</code> || parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. |
82
+
|[options.join.halign]| <code>string</code> | <code>"'left'"</code> | horizontal alignment style for images joined horizontally (`'left'`, `'centre'`, `'center'`, `'right'`). |
83
+
|[options.join.valign]| <code>string</code> | <code>"'top'"</code> | vertical alignment style for images joined vertically (`'top'`, `'centre'`, `'center'`, `'bottom'`). |
77
84
78
85
**Example**
79
86
```js
@@ -173,6 +180,22 @@ await sharp({
173
180
}
174
181
}).toFile('text_rgba.png');
175
182
```
183
+
**Example**
184
+
```js
185
+
// Join four input images as a 2x2 grid with a 4 pixel gutter
* @param {(Buffer|ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|Uint16Array|Int16Array|Uint32Array|Int32Array|Float32Array|Float64Array|string)} [input] - if present, can be
124
+
* @example
125
+
* // Join four input images as a 2x2 grid with a 4 pixel gutter
126
+
* const data = await sharp(
127
+
* [image1, image2, image3, image4],
128
+
* { join: { across: 2, shim: 4 }}
129
+
* ).toBuffer();
130
+
*
131
+
* @example
132
+
* // Generate a two-frame animated image from emoji
* @param {(Buffer|ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|Uint16Array|Int16Array|Uint32Array|Int32Array|Float32Array|Float64Array|string|Array)} [input] - if present, can be
125
139
* a Buffer / ArrayBuffer / Uint8Array / Uint8ClampedArray containing JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image data, or
126
140
* a TypedArray containing raw pixel image data, or
127
141
* a String containing the filesystem path to an JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image file.
142
+
* An array of inputs can be provided, and these will be joined together.
128
143
* JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF or raw pixel image data can be streamed into the object when not present.
129
144
* @param {Object} [options] - if present, is an Object with optional attributes.
130
145
* @param {string} [options.failOn='warning'] - When to abort processing of invalid pixel data, one of (in order of sensitivity, least to most): 'none', 'truncated', 'error', 'warning'. Higher levels imply lower levels. Invalid metadata will always abort.
* @param {boolean} [options.text.rgba=false] - set this to true to enable RGBA output. This is useful for colour emoji rendering, or support for pango markup features like `<span foreground="red">Red!</span>`.
170
185
* @param {number} [options.text.spacing=0] - text line height in points. Will use the font line height if none is specified.
171
186
* @param {string} [options.text.wrap='word'] - word wrapping style when width is provided, one of: 'word', 'char', 'word-char' (prefer word, fallback to char) or 'none'.
187
+
* @param {Object} [options.join] - describes how an array of input images should be joined.
188
+
* @param {number} [options.join.across=1] - number of images to join horizontally.
189
+
* @param {boolean} [options.join.animated=false] - set this to `true` to join the images as an animated image.
190
+
* @param {number} [options.join.shim=0] - number of pixels to insert between joined images.
191
+
* @param {string|Object} [options.join.background] - parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
192
+
* @param {string} [options.join.halign='left'] - horizontal alignment style for images joined horizontally (`'left'`, `'centre'`, `'center'`, `'right'`).
193
+
* @param {string} [options.join.valign='top'] - vertical alignment style for images joined vertically (`'top'`, `'centre'`, `'center'`, `'bottom'`).
0 commit comments