示例#1
0
        private void WriteImage()
        {
            //Old LZW encoder, only works with ColorTableSize 8.
            //var encoder = new FileWriters.GifWriter.LzwEncoder(0, 0, IndexPixels(ColorTable), 8);

            //New LZW encoder, ColorTableSize from 1 to 8. The plus 1 is just to adjust the range, it will mean the same amount of color.
            var encoder = new LzwEncoder(IndexPixels(ColorTable), ColorTableSize + 1);

            encoder.Encode(InternalStream);
        }
示例#2
0
 private void WriteImage()
 {
     //TODO: Fix the new LZW encoder when ColorTableSize == 7. It is getting corrupted.
     if (ColorTableSize < 7)
     {
         //New LZW encoder, ColorTableSize from 1 to 8. The plus 1 is just to adjust the range, it will mean the same amount of color.
         var encoder = new LzwEncoder(IndexedPixels, ColorTableSize + 1);
         encoder.Encode(InternalStream);
     }
     else
     {
         //Old LZW encoder, only works with ColorTableSize 8.
         var encoder = new ImageUtil.LegacyEncoder.LzwEncoder(0, 0, IndexedPixels, 8);
         encoder.Encode(InternalStream);
     }
 }