如果你有比以下程序更快速的http://d.ahjoe.com/z/ZoomTest.zip请提供演示程序地址或发到[email protected]注意: 网上找到的某些代码在做图像缩小时,结果是不正确的(与PhotoShop对比)。

解决方案 »

  1.   

    用strechblt觉得比你这个快,你这个太慢了。我用VB写的算法也比你这个快很多。下午给你看个例子。
      

  2.   

    演示程序中也有提供 StretchBlt的测试。如果做图像压缩,或者放大非整数倍的时候,它的效果很差的。
      

  3.   

    我上传的,你可以比较下
    http://files.cnblogs.com/laviewpbt/zyl910_Scale.rar
      

  4.   

    谢谢你!你这个我昨晚已经试过了.
    你的代码有点儿问题, 压缩时图像不正确(压缩到50%后与PhotoShop比较就知道了)。
    速度也比较慢,以长宽各放大到200%为例
    你的代码用时 0.321, 我的代码用时 0.104
      

  5.   

    先把24bit格式的源Bitmap和目标Bitmap准备好,然后只计转换所用的时间
      

  6.   

    procedure TForm1.Button3Click(Sender: TObject);
    label repzoom;
    var
      i: integer;
      tmp: integer;
    begin
      if Bmp1.Width = 0 then
        Exit;
      StatusBar1.Panels[0].Text := 'Processing...';
      StatusBar1.Panels[1].Text := '';
      StatusBar1.Panels[2].Text := '';
      StatusBar1.Panels[3].Text := '';
      Bmp2.Width := Bmp1.Width * Round(Rx.Value) div 100;
      Bmp2.Height := Bmp1.Height * Round(Rx.Value) div 100;
      ZoomTime := GetTickCount();
      i := 0;
    repzoom:
        ZoomBitmap24Int(Bmp2, Bmp1); // 源图 Bmp1, 目标图 Bmp2都是24bit格式
        
      Inc(i);
      tmp := GetTickCount();
      if tmp - ZoomTime < 1200 then
        goto repzoom;
      Count := i; // 转换次数
      ZoomTime := (tmp - ZoomTime) div i; // 平均时间
      PaintBox1.Width := Bmp2.Width;
      PaintBox1.Height := Bmp2.Height;
      PaintBox1.Invalidate();
    end;
      

  7.   

    hehe
    佩服,缩小的时候楼主的字体还是能看清除的,然我们的都不行了,GDI+的我试了也不行。楼主高人。
      

  8.   

    过奖了。对图像处理其实我是外行的,这是我的第一个图像处理代码。之前我用的缩放代码都是用这个版本的
    http://foe.bokee.com/6640682.html
    在做图像压缩的时候它的结果不正确,所以只好硬着头皮自己写了。
      

  9.   

    没什么特别要求的话,能用就行了。
    所谓线性插值,中心思想是考虑ab两点之间色彩值是线性变化,这种方法处理下来,图像效果要比StretchBlt(最近邻域法)稍好,但在图像细节部分会变得模糊。
      

  10.   

    都是高手啊,呵呵。小弟这两天也在做这个呢,不过不是图象处理,就是一般的图形缩放,却不知如何下手,学习ing