Topic: Quality of resized images

Hello Dmitry and all MVD fans,


Following up the tip on resizing images with MVD I posted earlier here : http://myvisualdatabase.com/forum/viewt … p?id=2815, I was wondering if Dmitry had some ideas about how to set the compression ratio to enhance the quality of the resized image ?


Cheers


Mathias

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: Quality of resized images

Hello Mathmathou

Does this make the job ?

var
  Bmp: TBitmap;
  Jpeg: TJpegImage;
begin
  Jpeg := TJpegImage.Create;
  try
    Jpeg.LoadFromFile('MyBigImage.jpg');
    Bmp := TBitmap.Create;
    try
      Bmp.Width := Jpeg.Width div 2;
      Bmp.Height := Jpeg.Height div 2;
      Bmp.Canvas.StretchDraw(Rect(0, 0, Bmp.Width, Bmp.Height), Jpeg);
      Jpeg.Assign(Bmp);
    finally
      Bmp.Free;
    end;
    Jpeg.SaveToFile('MyLittleImage.jpg');
  finally
    Jpeg.Free;
  end;
end;

provided that MVD uses JPEG unit (what I think).

For best picture quality do you mean by best ratio ?

JB

Re: Quality of resized images

Hello Jean and thank you for the effort smile


I was not talking about the pixel size of the picture, I was talking about the compression ratio of the image :


The initial image is a jpeg, so it's already compressed. Aftter assigning it to a bitmap, I was wondering if the StretchDraw function was applying a second ratio of compression or keeping the initial one. Sometimes, my resized images are a little blurry and I was looking for a method to smooth them smile


Cheers


Mathias

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: Quality of resized images

mathmathou
It's not related with the compression ratio, it's just fast algorithm for resize images which have not the best quality of work )

Dmitry.