feat: add safer nativeImage.createFromBitmap(), which does not decode PNG/JPEG (#17337)
This commit is contained in:
parent
aa8b66aae1
commit
878538f2e8
4 changed files with 91 additions and 1 deletions
|
@ -137,6 +137,19 @@ let image = nativeImage.createFromPath('/Users/somebody/images/icon.png')
|
|||
console.log(image)
|
||||
```
|
||||
|
||||
### `nativeImage.createFromBitmap(buffer, options)`
|
||||
|
||||
* `buffer` [Buffer][buffer]
|
||||
* `options` Object
|
||||
* `width` Integer
|
||||
* `height` Integer
|
||||
* `scaleFactor` Double (optional) - Defaults to 1.0.
|
||||
|
||||
Returns `NativeImage`
|
||||
|
||||
Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap
|
||||
pixel data returned by `toBitmap()`. The specific format is platform-dependent.
|
||||
|
||||
### `nativeImage.createFromBuffer(buffer[, options])`
|
||||
|
||||
* `buffer` [Buffer][buffer]
|
||||
|
@ -147,7 +160,7 @@ console.log(image)
|
|||
|
||||
Returns `NativeImage`
|
||||
|
||||
Creates a new `NativeImage` instance from `buffer`.
|
||||
Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or JPEG first.
|
||||
|
||||
### `nativeImage.createFromDataURL(dataURL)`
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue