Fit

Function
This function changes the image resolution, resizing the image to fit inside of a frame. Fit will not stretch the image in either axis; it zooms X and Y by the same amount until either one fits in the new resolution that you specify. For example, if you have a 100x200 image, and fit it into a 250x250 resolution, it will zoom the image up by 25% (250/200 = 1.25), and pad black pixels on both the left and right edges.

Parameters
Type
Defaults
Function
xSize/ySize
int
width/height The new output resolution.
x/yFilter
string
"default" The filter to be used for resampling the image. "default" means sinc filter when resizing down, and mitchell when increasing resolution.
preCrop
int
1 This will turn off the infinite workspace so that the letterbox area remains black.


Synopsis

image Fit( 
  image, 
  int xSize, 
  int ySize,
  const char * xFilter,
  const char * yFilter,
  int preCrop
);


Script

 image = Fit( 
  image, 
  xSize, 
  ySize,
  "xFilter",
  "yFilter",
  preCrop
 );

Command Line

shake -fit xSize ySize


See Also
Resize, Crop, Window, Viewport, Scale