Var output = new Bitmap(input.Width, input.Height, PixelFormat.Format1bppIndexed) public static Bitmap ConvertTo1Bit(Bitmap input) Despite this, performance seems acceptable. For example, it copies the entire input image into the data array, whereas we really only need to keep two lines in memory (the "current" and "next" lines) for accumulating the error data. There are a number of improvements that could be applied if you wanted. ![]() ![]() Note that this should by no means be considered an "ideal" implementation, but it does work. Here's some code I put together that takes a full colour (24 bits/pixel) image, and converts it to a 1 bit/pixel output bitmap, applying a standard RGB to greyscale conversion, and then using Floyd-Steinberg to convert greyscale to the 1 bit/pixel output.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |