I need to convert a png with color into a png that is only black and white. I'm currently processing images Sharp.js. But I haven't been able to find a way to generate a monochromatic image.
I found a greyscale option.
const sharp = require('sharp');
sharp('color-image.png')
.toGreyscale()
.toFile('b-w-image.png')
.then(() => {
console.log('Huzzah!')
});
But this doesn't work for my needs. I'm looking for a pure black and white image with no shades of grey.
I haven't found anything in the documentation that allows you to specify the level of greyscale to allow for only a B/W image.
Is there a method available that converts the image into pure black and white?