2

We have a .NET application which currently creates documents to TIFF files by printing to a virtual printer. We would like to get rid of the virtual printer because it is expensive, slow, and does not support 64-bit operating systems. Right now, I can use other tools at my disposal to create a TIFF image from, say, a Word document at 300 dpi. However, I don't have a great deal of control over the final TIFF format; specifically, it creates full 24-bit true color images and thus very large TIFF files. The legacy solution, for all of its faults, does create nice 8-bit palette color TIFF files.

So my question is this: is there a straightforward, efficient way to convert a 24-bit, truecolor image to an 8-bit palette color image? It would be nice if the resulting palette was optimized for the particular image, but I realize that analyzing every pixel is probably too slow. A solution that used a standard 8-bit palette would certainly be acceptable. Is there a method in the .NET imaging library that will do this, or a third-party, open source tool? I've messed around a little with ImageMagick.NET, but was not very pleased with the experience.

Eric Pohl
  • 2,324
  • 1
  • 21
  • 31
  • Have you checked this on SO: http://stackoverflow.com/questions/4441388/bayer-ordered-dithering – Simon Mourier Apr 04 '11 at 20:50
  • Palettes went the way of the dodo, along with the video adapters that required them. The factor of 3 was made up in spades since then. Throw hardware at the problem. – Hans Passant Apr 04 '11 at 21:05
  • Unfortunately, it's not our hardware. We're producing the TIFF images for clients to store/view in their own systems. They are expecting them to be the same size as before, but they use, in many cases, some pretty old legacy systems. – Eric Pohl Apr 05 '11 at 15:22

2 Answers2

0

If you save in .gif format, it should use a 256 color palette image. That may be an easy solution if your client can read .gif files. Leadtools can save paletized .tif files, but it's not open source.

xpda
  • 15,585
  • 8
  • 51
  • 82
0

Check out FreeImage. There's a bunch of save flags that you can pass where you can specify compression levels. There's also a method called ConvertColorDepth that sounds promising. You'll have to look over the license to see if it fits you.

Chris Haas
  • 53,986
  • 12
  • 141
  • 274