Size >>
 Width : Integer
 Height : Integer
;

MAX_* :
 SIZE
 AREA
;

/* * */

Size ->
Arg Size : &Size, 
    File : String,  
    Bounds : Size = ., 
    Method : MAX_* = MAX_SIZE

Size.
 Width = ImageSize( File, IMG_WIDTH )
 Height = ImageSize( File, IMG_HEIGHT )
;

- Adjust 'Size' Bounds Method
[ Size.Width > Bounds.Width | Size.Height > Bounds.Height ]
[ Bounds ]

/

Adjust Size ->
Arg Size : ^&Size, Bounds : Size, Method : MAX_*

Let Size.Width > 0 && Size.Height > 0 &&
    Bounds.Width > 0 && Bounds.Height > 0, ERR_PARAMETER

Width = Size.Width = ( ( Size.Width / 3 ) * 2 ) % 1
Height = Size.Height = ( ( Size.Height / 3 ) * 2 ) % 1

Fit, Scale = 0 ..

Do while !Fit
 Scale ++

 If Scale > 1 then
  Size.Width = ( Width / Scale ) % 1
  Size.Height = ( Height / Scale ) % 1
 ;

 If Size.Width <= Bounds.Width then
  If Method = MAX_SIZE then
   If Size.Height <= Bounds.Height then Fit = 1
   Else _
  Else
   If Size.Width * Size.Height <= Bounds.Width * Bounds.Height then Fit = 1
   Else _
  ;
 Else
  _
 ;
;

/