Показать сообщение отдельно
  #6  
Старый 10.03.2011, 10:04
x128 x128 вне форума
Новичок
 
Регистрация: 03.02.2010
Сообщения: 64
Репутация: 133
По умолчанию

пример:
Код:
procedure resize_img(img: TImage; nx, ny: integer);
var
  t: TBitmap;
  h: THandle;
  scale: double;
begin
  if img.Proportional then begin
    scale:=max(img.Height/ny, img.Width/nx);
    if scale<1 then scale:=1;
    nx:=trunc(img.Width/scale);
    ny:=trunc(img.Height/scale);
  end;
  t:=TBitmap.Create;
  t.Assign(img.Picture.Graphic);
  t.PixelFormat:=pf24bit;
  h:=t.Canvas.Handle;
  SetStretchBltMode(h, HALFTONE);
  StretchBlt(h, 0,0,nx,ny, h, 0,0,t.Width,t.Height, SRCCOPY);
  t.Width:=nx;
  t.Height:=ny;
  img.Picture.Assign(t);
  t.Free;
end;
на входе имидж с загруженной картинкой и новые размеры.
Ответить с цитированием