我想把普通机器上的图片(比如JPEG格式)上传到网上,然后让PDA能访问到
我如何把一个800*600的分辨率缩小为300*200后再上传上去
谢谢了

解决方案 »

  1.   

    uses
      Graphics, JPEG;procedure ZoomImage(var JpegImage: TJpegImage; SetWidth: integer; SetHeight:
      integer); implementationfunction BmpToJpg(var Value: TBitmap): TJpegImage;
    begin
      Result := nil;
      if Assigned(Value) then
      begin
        Result := TJpegimage.Create;
        Result.Assign(Value);
        Result.CompressionQuality := 70; 
        Result.JPEGNeeded;
        Result.Compress;
      end;
    end;procedure ZoomImage(var JpegImage: TJpegImage; SetWidth: integer; SetHeight:
      integer); overload;
    var
      BitMapTmp, Bitmap: TBitmap;
    begin
      JpegImage.DIBNeeded;
      Bitmap := TBitmap.Create;
      try
        Bitmap.Assign(JpegImage);
        JpegImage.Free;
        BitMapTmp := TBitmap.Create;
        try
          BitMapTmp.Assign(BitMap);
          Bitmap.Width := SetWidth;
          Bitmap.Height := SetHeight;
          Bitmap.Canvas.StretchDraw(Bitmap.Canvas.ClipRect, BitMapTmp);
        finally
          BitMapTmp.Free;
        end;
        JpegImage := BmpToJpg(Bitmap);
      finally
        Bitmap.Free;
      end;
    end;
    调用ZoomImage就行了