The most simple way to resize an image is probably the following :
procedure ResizeImage(Image : TGraphic; AWidth, AHeight : Integer);
var bmp : TBitmap;
begin
bmp := TBitmap.Create;
try
bmp.PixelFormat := pf32bit;
bmp.Width := AWidth;
bmp.Height := AHeight;
bmp.Canvas.StretchDraw(Rect(0,0,AWidth, AHeight), Image);
Image.Assign(bmp);
finally
bmp.Free;
end;
end;
Note that, while simple, it has many flaws. You will probably lose transparency information. I am unsure whether or not meta information of the original image will be preserved.
Maybe not all graphic class support stretchdraw. I tested with JPEG, but maybe png or tif don't support it.
The routine also assume that the TGraphic class knows how to assign itself a bitmap (which most, if not all, should do).
As for compression, many image format already compress the data, JPEG, PNG, some TIFF. Coming with a more efficient compression algorithm than what is already available would be no easy feat.