Yearly Archive: 2017

Slice an image in AfterEffects for making prints or ???

The following code will let you take an image… let’s say a photograph and slice it up into a bunch of tiles that can be saved and printed.
Step 1: Create a ‘render comp’ that is the size of the print you will want (ie. for a 4″x6″ print @ 300dpi, you would set the comp to be 1200px X 1800px) (this script assumes a framerate of 24fps)
Step 2: Place your photo/image/precomp into this render comp.
Step 3: Paste the following as an expression into the image layers’ ‘Anchor Point’ property…
compWidth = thisComp.width;
compHeight = thisComp.height;
srcWidth = width;
srcHeight = height;
countX = Math.ceil(srcWidth / compWidth);
countY = Math.ceil(srcHeight / compHeight);
centerOffsetX = (srcWidth%compWidth)/2;
centerOffsetY = (srcHeight%compHeight)/2
frame = time*24;
xCount = Math.ceil(srcWidth / compWidth);
yCount = Math.ceil(srcHeight / compHeight);
indexX = frame % xCount;
indexY = Math.floor(frame/xCount);
half_height = compHeight/2;
x = compWidth*indexX;
x += centerOffsetX;
y = compHeight*indexY;
y += centerOffsetY;
[x,y]
Step 4: Step through the render comp frame by frame and you should see the image moving to a new position each frame, that will seamlessly stitch back together. Render out an image sequence and send them off to the printer!