.net中使用GDI+提高gif图片画质代码

    在.net中使用GDI+来提高gif图片的保存画质,这就是“Octree“ 算法。“Octree“ 算法允许我们插入自己的算法来量子化我们的图像。

    使用octreequantizer很方便:

隐藏行号 复制代码 代码
  1.  system.drawing.bitmap b = new System.Drawing.Bitmap("c:\original_image.gif");  
    
  2. System.Drawing.Image thmbnail = b.GetThumbnailImage(100,75,null,new IntPtr()); 
    
  3. OctreeQuantizer quantizer = new OctreeQuantizer ( 255 , 8 ) ; 
    
  4. using ( Bitmap quantized = quantizer.Quantize ( thmbnail ) ) 
    
  5. { 
    
  6.      quantized.Save("c:\thumnail.gif", System.Drawing.Imaging.ImageFormat.Gif); 
    
  7. } 
    
  8. octreequantizer grayquantizer = new GrayscaleQuantizer ( ) ; 
    
  9. using ( Bitmap quantized = grayquantizer.Quantize ( thmbnail ) ) 
    
  10. { 
    
  11.      quantized.Save("c:\thumnail.gif", System.Drawing.Imaging.ImageFormat.Gif); 
    
  12. } 
    

你可能感兴趣的:(.net,图片,button,工具栏,title)