Resize images using Electron. Supports all image types that Chromium/Electron supports, outputs to png, jpeg, dataUrl or NativeImage.
$ npm install --save electron-image-resize
const electronImageResize = ;const writeFileSync = ;// Resize the svg image to 40x40
URL of image to resize. For local paths prefix the path with '
width and height
At Least One Is Required
The width in pixels to resize the image to. The height in pixels to resize the image to. If only one dimension is provided, the image will be re-sized so that the original height/width ratio is maintained.
We will wait until the image is loaded but often you will need to also add a delay to give the renderer time to paint the image before capturing it.
Returns a promise which resolves to a NativeImage. Use methods like
.toJpeg() to get a buffer which you can use to write to the file system.
MIT © DaveJ