title: Compressing a bitmap using Encoder in C#
body: <p>I am doing a WPF forms application for compress .bmp images in my project. 
  I want to compress an image using RLE compression algorithm and Huffman.
   I tried below code by referring MSDN, but original image and compressed images have same sizes.</p>
  
  <pre><code>    private List&lt;double&gt; HuffmanAndRle(int size)
      {
          try
          {
              if((size &gt; _image.Width) || (size &gt; _image.Height))
                  throw new Exception("size is too large");
              Bitmap bitmaporg = crop(size);
              Bitmap bitmapRLE = crop(size);
              Bitmap bitmapHuffman = crop(size);
              ImageCodecInfo myImageCodecInfo ;
  
              myImageCodecInfo = GetEncoderInfo("image/bmp");
  
  
              var myEncoderParameters = new EncoderParameters(1);
              var enc = new Encoder(Encoder.Compression.Guid);
              myEncoderParameters.Param[0] = new EncoderParameter(enc, (long)EncoderValue.CompressionCCITT4);
              bitmapHuffman.Save("C:/Hffman.bmp", myImageCodecInfo, myEncoderParameters);
              //bitmapHuffman.Save()
  
  
              var myEncoderParameters1 = new EncoderParameters(1);
              myEncoderParameters1.Param[0] = new EncoderParameter(Encoder.Compression, (long)EncoderValue.CompressionNone);
              bitmaporg.Save("C:/org.bmp", myImageCodecInfo, myEncoderParameters1);
  
  
  
              var myEncoderParameters2 = new EncoderParameters(1);
              myEncoderParameters2.Param[0] = new EncoderParameter(Encoder.Compression, (long)EncoderValue.CompressionRle);
              bitmapRLE.Save("C:/RLE.bmp", myImageCodecInfo, myEncoderParameters2);
  
  
              var org =new BitmapImage(new Uri("C:/org.bmp"));
              var rle = new BitmapImage(new Uri("C:/RLE.bmp"));
              var huffman = new BitmapImage(new Uri("C:/Hffman.bmp"));
  
              var dobles = new List&lt;double&gt;();
              dobles.Add(ImageSize2(huffman)/ImageSize2(org));
              dobles.Add(ImageSize2(rle)/ImageSize2(org));
              return dobles;
  
          }
          catch (Exception e)
          {
              MessageBox.Show("Error : " + e.Message);
              return null;
          }
      }
  </code></pre>
  
  <p>so where is the problem ??</p>