I want to convert an image from color to B/W (i.e. no grayscale, just black and white). Does anyone have a good colormatrix to achieve this?
相关问题
- Views base64 encoded blob in HTML with PHP
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- How to get the background from multiple images by
- Why am I getting UnauthorizedAccessException on th
You dont need a color matrix to achive this, just simply change encoding to CCITT! That only Black & White. Result remains correct and result file size is very small. Also much more efficient and faster than
System.DrawImage
.This is the perfect solution:
If you want it to look halfway decent, you'll probably want to apply some form of dithering.
Here's a full discussion, if a bit dated:
http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT
VB.NET version:
I've finally found a solution to my problem:
Here is the C# code:
I've benchmarked this code and it is approximately 40 times faster than pixel by pixel manipulation.