Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
uses JPEG;
....
procedure ResampleJPEG(AJPG : TJPEGImage; AWidth, AHeight : Integer; AFileName : String);
var
bmp : Tbitmap;
rect : TRect;
begin
rect.Left := 0; //left corner
rect.Top := 0; //top
rect.Right := AWidth; //width
rect.Bottom := AHeight; //height
bmp := TBitmap.Create;
bmp.Width := rect.Right;
bmp.Height := rect.Bottom;
bmp.Canvas.StretchDraw(rect,AJPG);
AJPG.Assign(bmp);
AJPG.CompressionQuality := 100;
AJPG.SaveToFile(AFileName);
bmp.Free;
end;
function ResizeImg(Image : TJPegImage) : TJPegImage;
var bitmap: TBitmap;
const Dispwidth = 309;
begin
Try
bitmap := TBitmap.create;
result := TJPegImage.create;
bitmap.width := Dispwidth;
bitmap.height := round(Image.Height/(Image.Width/Dispwidth));
bitmap.canvas.stretchDraw(rect( 0,0, Dispwidth, round(Image.Height/(Image.Width/Dispwidth))), Image);
result.Assign(bitmap);
result.JpegNeeded;
Finally
bitmap.free;
end;
end;
function RotateImg(Bitmap : TBitmap): TBitmap;
var
x,y : Integer;
H,W : Integer;
begin
W:=Bitmap.Width;
H:=Bitmap.Height;
Result := TBitmap.Create;
try
with Result do
begin
Width:=H;
Height:=W;
for x:=0 to W-1 do
for y:=0 to H-1 do Canvas.Pixels[H-y-1,x]:=Bitmap.Canvas.Pixels[x,y];
end;
except
Result.Free;
raise;
end;
end;