The idea is to take a short video clip of a rotating object and convert it to a GIF89a file which will play in an endless loop in a web browser.
By using a motorized turntable such as a record player, the object can be made to rotate at a constant speed which makes the process much easier - a norrmal video can be recorded, rather than using stop-motion animation.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Prepare the Turntable
Remove the spindle from the record player - the pin that holds the record centered. Place a piece of card or other material over the platter so that it is free to rotate. Place more card underneath and behind the platter to act as a backdrop - or at least, to make it look not so obviously a record player.
If green card is used, the background may later be replaced using a Chroma key process
Step 2: Shoot the Video
Set up a video camera on a tripod so that the camera has a clear view of the model with the card in the background. It does not matter so much if objects such as the tone arm are visible to one side, as the video may be cropped. But the model should rotate entirely in a space with an unobstructed background.
Set up the lighting. To avoid obvious shadows, I used a small hand-held lamp with a diffuser bounced off a white ceiling, but it is not bright enough for good video quality. (the image here was taken with room lighting)
Place the model in the centre of the platter and start the turntable. Take about a second of video - at least one complete rotation. If desired, take more shots with different lighting, camera height, focus etc.
Step 3: Process the Video
How to process the video depends on what software you have available. I use Linux with the following programs:
mplayer - video player
ImageMagick - scriptable image manipulation
xv (or eog, display etc.) - image viewer and manipulation
whirlgif or gifsicle - tool to create animated GIFs
xanim - animation viewer
(This is just a collection of free software that I already had and was familiar with, rather than what I would recommend others to
acquire. ImageMagick is pre-installed in many Linux distributions.)
With this tool set, I converted the video to a series of JPEG frames, cropped and selected a subset of these images,
converted them to GIF and assembled them into a composite GIF animation.
$ mplayer -vo jpeg MVI_0035.AVI
This creates one image per frame, 00001.jpg, 00002.jpg, 00003.jpg etc.
Find a boundng box that contains the model in all rotations and excludes unwanted elements such as the tone arm. I used xv to draw a box and show the coordinates, but it was perhaps easier just to guess and adjust the crop box later. The picture below shows a typical bounding box.
Identify two frames exactly one rotation of the turntable apart (about 2 seconds for an LP setting of 33 RPM). Save all the intervening frames. I found it easiest to delete the unwanted ones. E.g. if frames 1 and 54 were identical, I deleted frames 54, 55, 56 ... 103,
leaving seqentially numbered files 0001.jpg etc.
Convert and crop the images to GIF. The following worked for me, using the ImageMagick "convert" command in bash:
$ for f in 0*jpg ; do
g=`echo $f|sed s/jpg/gif/`
convert -crop 400x350+160+78 $f tmp.jpg
convert -resize 200x175 tmp.jpg $g
That gives sequential images 00001.gif, 00002.gif etc. half the size of the original, cropped from the middle of each frame.
If the cropped area is not right, it's easy to change the numbers and re-run the command with a couple of keystrokes.
The intermediate JPEG is probably not necessary, but without it my final image was offset on the screen.
Assemble the individual GIF frames into a single animation, e.g.
$ whirlgif -loop 0 -o MVI_0035.gif
$ gifsicle --colors 64 -O1 --careful --delay 10 --loopcount=forever 00*gif > MVI_0035.gif
The resulting GIF can be viewed in a web browser such as Firefox, or in e.g. xanim (which can single-step through the animation
Step 4: Adding a Background
In order to add a background, I covered the brown card background with blue paper, and took another video of the rotating models. Then with the same lighting I removed the models and took some video of the turntable without moving the camera. Then, using ImageMagick, I subtracted the background image from the foreground and made two masks, a positive and negative.
I then masked out the background in each video frame, masked out the shape of the models in a background picture, and added the two images.
All this goes inside the loop, so each frame is processed separately before being combined in the animated GIF.
$ composite -compose minus back.gif frame.gif minus.gif
$ convert -white-threshold 8000 -gamma 0.3 -colors 2 minus.gif mask.gif
$ convert -negate mask.gif neg-mask.gif
$ composite -compose multiply frame.gif mask.gif masked-frame.gif
$ composite -compose multiply -geometry +50+90 neg-mask.gif beach.gif masked-beach.gif
$ composite -compose add -geometry +50+90 masked-frame.gif masked-beach.gif final.gif
Many video-editing software packages would have this function built-in as "chroma key"
Participated in the