Fit

Function
The Fit function changes the image resolution, resizing the image to fit inside of a frame. Fit does not stretch the image in either axis; it zooms X and Y by the same amount until either value fits in the new resolution (that you specify). For example, if you have a 100 x 200 image, and fit it into a 250 x 250 resolution, it zooms the image by 25 percent (250/200 = 1.25), and pads black pixels on 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