Wrote by Les Hamilton, 8 Feb 2015: Here is the code you asked about. It is in Delphi, a variety of Pascal. The first procedure below sets "Autosize" as true. This makes the image (called "RAWimage") its full size. The width of the image is held in the variable "picwid", height in "picht". The 2nd procedure makes "Autosize" false, and sets new, smaller values, for the width and height of the image. ------------------------------ procedure TMainForm.ActualSizeClick(Sender: TObject); begin RawImage.Autosize:=true; end; ------------------------------ procedure TMainForm.FitScreenClick(Sender: TObject); var h,w:integer; begin h:=ScrollBox.Height; w:=round(h*picwid/picht); With RawImage do begin Autosize:=false; width:=w; height:=h; end; end; ------------------------------