Re: Bug with B&W conversion
Bob Friesenhahn <[email protected]> Sun, 9 Jan 2011 19:24:03 -0600 (CST)
| Newsgroups | gmane.comp.video.graphicsmagick.bugs |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 10 Jan 2011, Andrew Stonewall wrote: > Hi Bob, > This bug goes back to the ImageMagick base-code for the 'riemersma' dither routine. I raised this on the > ImageMagick forums some time back (http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=17251) but > had a hard time convincing their admin that it was a real problem. There is definitely a weakness in the algorithm, but it may be difficult to solve. Color reduction is really intended for full-range photos. > The main reason I'm using ImageMagick (and now GraphicsMagick) is > that this routine provides an exceptional B&W conversion on some > very 'noisy' documents that I'm processing at the moment so using > another dither isn't an option. Yes, the quality of the dither can be very nice. Slow but nice. Both -ordered-dither and -random-threshold provide recognizable output from your image but the results are not as nice. An alternative is to use local adaptive thresholding (-lat). This algorithm is good for bringing out the original features of the scan. The best parameters to use depend on your input image and require some experimentation. Here is an example: gm convert original.bmp -colorspace gray -lat 10x10-4% output.bmp In this example, it computes the average value of the pixels in a 10x10 rectangle around the target pixel. Then it thresholds based on the pixel value being more than 4% different than the average. This algorithm can use a lot of CPU so it is best to keep the rectangle size down to the smallest size which reliably works. The end result captures all of the written/detail bits, while eliminating the page background. Perhaps this is what you wanted in the first place? Bob -- Bob Friesenhahn [email protected], http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ ------------------------------------------------------------------------------ Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Graphicsmagick-bugs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/graphicsmagick-bugs