jimp-dev / jimp

An image processing library written entirely in JavaScript for Node, with zero external or native dependencies.
http://jimp-dev.github.io/jimp/
MIT License
13.97k stars 762 forks source link

Clarify documentation: callback not required to create an image #957

Open stevage opened 3 years ago

stevage commented 3 years ago

The documentation says:

Iyou want to begin with an empty Jimp image, you can call the Jimp constructor passing the width and height of the image to create and a Node-style callback:

 new Jimp(256, 256, (err, image) => {
  // this image is 256 x 256, every pixel is set to 0x00000000
});

However, it works fine to not pass the callback:

const image = new Jimp(256, 256);

Not sure if both options are valid, but it would have made my code simpler from the start if I realised I didn't need the callback.

hipstersmoothie commented 1 year ago

Yeah I think everywhere we should push people towards this and not callbacks