Returns `NativeImage`
Creates a new `NativeImage` instance from `buffer`. The default `scaleFactor` is
-1.0. The `width` and `height` options are **required** for bitmap buffers.
+1.0. The `width` and `height` options are **required** and only used for bitmap
+buffers.
### `nativeImage.createFromDataURL(dataURL)`
const imageD = nativeImage.createFromBuffer(imageA.toBitmap(),
{width: 538, height: 190})
assert.deepEqual(imageD.getSize(), {width: 538, height: 190})
+
+ const imageE = nativeImage.createFromBuffer(imageA.toBitmap(),
+ {width: 100, height: 200})
+ assert.deepEqual(imageE.getSize(), {width: 100, height: 200})
+
+ const imageF = nativeImage.createFromBuffer(imageA.toPNG(),
+ {width: 100, height: 200})
+ assert.deepEqual(imageF.getSize(), {width: 538, height: 190})
+
+ const imageG = nativeImage.createFromBuffer(imageA.toJPEG(100),
+ {width: 100, height: 200})
+ assert.deepEqual(imageG.getSize(), {width: 538, height: 190})
})
})