AutoFit Macro |
This is similar to Fit, except you give only one dimension, and you tell Shake which dimension you want it to calculate. For example, if you want to resize an image to fit 100 pixels wide, but you don't know the height, you would enter 100 and height (1) as your values. Shake will automatically figure out the the height for you. Instead of 0 or 1, you can also enter w or h as your argument
for the dimension Shake should calculate.
|
image AutoFit(image img, int resolution, int calculate) { curve w=0; curve h=1; return Select(calculate+1, Resize(img,resolution*width/height,resolution), Resize(img,resolution,resolution*height/width) ); } |