lundi 4 juillet 2016

Convert image to variable number of grayscales

I want to convert an image to a variable number of grayscales, the number which is to be configurable by the user, ranging from 2 (monochrome/black and white) to 256 (full grayscale).

I've tried to accomplish this with both css and svg filters, e.g. in CSS:

filter: grayscale(100%)

converts an image to grayscales, which is what I'd want for 256 grayscales but other values like

filter: grayscale(10%)

do not limit the number of grayscales, but only reduce the number of colors used in the picture, so I can never get a monochrome result using these filters.

Thanks for your help.

Aucun commentaire:

Enregistrer un commentaire