Search code examples
c#tifffreeimage

FreeImageNet Save TIFF_CCITTFAX3 or TIFF_CCITTFAX4 does not work


Compression in TIFF_CCITTFAX3 or TIFF_CCITTFAX4 does not work properly, the resulting file is always in TIFF_LZW format

Ex :

FreeImage.Save(FREE_IMAGE_FORMAT.FIF_TIFF, dib, outFileName, FREE_IMAGE_SAVE_FLAGS.TIFF_CCITTFAX3);

how to solve this problem ?

Thanks Njara


Solution

  • The solution is to convert color image to monochrome before saving

    //dib = FreeImage.Threshold(dib, 128);
    dib = FreeImage.Dither(dib, FREE_IMAGE_DITHER.FID_CLUSTER6x6);
    //dib = FreeImage.ConvertColorDepth(dib, FREE_IMAGE_COLOR_DEPTH.FICD_01_BPP);
    FreeImage.Save(FREE_IMAGE_FORMAT.FIF_TIFF, dib, outFileName, FREE_IMAGE_SAVE_FLAGS.TIFF_CCITTFAX4);
    

    Thanks