Bitmap imageFile =new Bitmap("A.TIF");
int x=imageFile.Width;
int y=imageFile.Height ;
Bitmap originalBitmap=new Bitmap(x,y); 
Graphics g1=Graphics.FromImage(originalBitmap);
g1.DrawImage(imageFile,0,0,x,y);
originalBitmap.Save("B.TIF", System.Drawing.Imaging.ImageFormat.tif  ) ;代码如上.处理前的a.tif只有100多K,是扫描出的单色图片,处理后的b.tiF图片变成了900多K.据调查,处理前的图片的PixelFormat是Format1bppIndexed,处理后变成了Format32bppArgb.所以图片变大.想知道如何能让图片的大小不要变化那么大啊.请高人指点啊...

解决方案 »

  1.   

    使用其他重载函数看看,比如:[C#]
    public void Save(
       string filename,
       ImageCodecInfo encoder,
       EncoderParameters encoderParams
    );
      

  2.   

    刚才说的不大对,你这样试试看,因为我没有单色tif图片,所以不能测试,只能你试试看了。把
    Bitmap originalBitmap=new Bitmap(x,y); 
    改成
    Bitmap originalBitmap=new Bitmap(x,y,PixelFormat.Format1bppIndexed);
      

  3.   

    我试过了.不行.是因为Graphics g1=Graphics.FromImage(originalBitmap);不支持单色.所以我才多加了中间的代码.要不就Graphics g1=Graphics.FromImage("a.tif");了.是不是这个根本没办法解决啊.
      

  4.   

    我测试以下代码,文件大小变小了,从29k变成3k了。
    我是从画笔里面保存的单色位图,然后用ACDSee转换成TIF的,
    Bitmap imageFile =new Bitmap("测试TIF图片.tif");
    imageFile.Save("B.TIF", System.Drawing.Imaging.ImageFormat.Tiff);你的图片怎么会变大呢?
    要不把你的图片发到[email protected],我看看。