When we requested the capturing source, we provided a thumbnail size that's equal to the size of the main screen. Now you can use the NativeImage methods to perform any necessary image conversion and manipulation.
Many useful APIs are exposed by the NativeImage class. You can find out more at https://electronjs.org/docs/api/native-image#class-nativeimage.
For now, you need the following functions to finish the application:
- toPNG: This converts image data into png format.
- resize: This manipulates the size of the resulting image.
- crop: This cuts out a portion of the image.
You can convert the screen thumbnail into a png image using the following code:
const image = entireScreenSource.thumbnail.toPNG();
Follow these steps to get started:
- First, let's import the os, path, and fs classes from Node.js so that we can generate temporary...