mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Expose erode and dilate operations #4243
This commit is contained in:
committed by
Lovell Fuller
parent
03e1b19764
commit
031c808aa5
@@ -314,3 +314,6 @@ GitHub: https://github.com/happycollision
|
||||
|
||||
Name: Florent Zabera
|
||||
GitHub: https://github.com/florentzabera
|
||||
|
||||
Name: Quentin Pinçon
|
||||
GitHub: https://github.com/qpincon
|
||||
|
||||
@@ -284,6 +284,52 @@ const gaussianBlurred = await sharp(input)
|
||||
```
|
||||
|
||||
|
||||
## dilate
|
||||
> dilate([width]) ⇒ <code>Sharp</code>
|
||||
|
||||
Expand foreground objects using the dilate morphological operator.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [width] | <code>Number</code> | <code>1</code> | dilation width in pixels. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp(input)
|
||||
.dilate()
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## erode
|
||||
> erode([width]) ⇒ <code>Sharp</code>
|
||||
|
||||
Shrink foreground objects using the erode morphological operator.
|
||||
|
||||
|
||||
**Throws**:
|
||||
|
||||
- <code>Error</code> Invalid parameters
|
||||
|
||||
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [width] | <code>Number</code> | <code>1</code> | erosion width in pixels. |
|
||||
|
||||
**Example**
|
||||
```js
|
||||
const output = await sharp(input)
|
||||
.erode()
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
|
||||
## flatten
|
||||
> flatten([options]) ⇒ <code>Sharp</code>
|
||||
|
||||
|
||||
@@ -45,6 +45,10 @@ Requires libvips v8.16.1
|
||||
[#4207](https://github.com/lovell/sharp/pull/4207)
|
||||
[@calebmer](https://github.com/calebmer)
|
||||
|
||||
* Expose erode and dilate operations.
|
||||
[#4243](https://github.com/lovell/sharp/pull/4243)
|
||||
[@qpincon](https://github.com/qpincon)
|
||||
|
||||
* Add support for RGBE images. Requires libvips compiled with radiance support.
|
||||
[#4316](https://github.com/lovell/sharp/pull/4316)
|
||||
[@florentzabera](https://github.com/florentzabera)
|
||||
|
||||
Reference in New Issue
Block a user