Compositing scripts
Table of Contents
2x2 array
Overlap masks
Puts 4 image sequences in 2x2 array. Each animation blends into its neighbours using the included masks.
command to create a mask for the horizontal overlap of two images
convert -size 333x300 xc:white xc:black -size 333x120 gradient: +swap -append -rotate 90 overlap_mask.png
command to create a mask for appending two images vertically
convert -size 720x243 xc:white xc:black -size 720x90 gradient: +swap -append -flip overlap_mask_total.png
script
commands: extend, gravity, composite, limit area, limit memory
bash scripts: cyclical
Twirling array
Script for 4 twirling image sequences in a 2x2 array, animations resize to fit in screen.
commands (montage): rotate, tile, geometry
bash scripts: cyclical, decimaladd
Small twirl
Script for 4 twirling image animations in a 2x2 array, fits screen size to stay the same size.
As can be seen by the previous example imagemagick will change the size of the original image so that no overlapping will occur and the images remain within the frame. To counteract this the original images have to be sized so that they will remain within their quarter of the picture regardless of their angle of rotation.
math
The hypethenuse of the image may at no point exceed the vertical of the frame. Assuming we're using a 1/4 pal frame size for a 2x2 array, I used a web hypothenuse calculator to calculate the image size.
opposite=360
adjacent=288
angle-q=51.34 (can easily be calculated using opposite and adjacent)
angle-b=38.66 (can easily be calculated using opposite and adjacent)
using angle-q and a hypothenuse of 288 (shortest point in the square)
opposite=224
adjacent=180
script
commands: size, xc:, background, rotate, gravity, composite, append
bash scripts: cyclical, decimaladd
Circle twirl
Script for 4 twirling image sequences in a 2x2 within diffused circle masks (mask commands incl.)
creating circle mattes
create circle
convert -size 360x288 xc:none -fill black -draw "circle 180,144 100,70" circle.png
blur circles
convert circle.png -channel RGBA -blur 0x20 black_blurred.png
make blur visible, probably not necessary if other -compose method is used in script
convert black_blurred.png -channel matte -separate +matte matteblackblur.png
script
commands: rotate, compose Screen, composite, append, gravity
bash scripts: cyclical, decimaladd
Washroom tile look
Script for twirling image animation in a 4x4 array within the original animation using circle masks.
mask commands
Command to create circle which is 1/4 of the size of a pal image (720x576).
convert -size 180x144 xc:none -fill black -draw "circle 90,72 34,27" circlesmall.png
Command to make the above mask transparent everywhere except for the circle.
convert circlesmall.png -matte -transparent white transparentwhite.png
script
commands: crop, rotate, gravity, compose src-in, matte, background none, append, compose src-over, composite
bash scripts: cyclicalrepeat, decimaladdtotal
Overlay
Script overlaying one image sequence over another allowing background to show through whites.
commands: -threshold, -compose multiply, -composite
bash scripts: cyclical
Crop and mask overlay
Script overlaying one image animation over another allowing background to show through mask created by a third.
Script to crop, double, change threshold and resize mask sequence
commands: crop, repage, clone, append, threshold
Script to overlay and mask other two sequences o
Splice
Script overlaying one image sequence over another allowing background to show through mask created by drawing lines.
commands: xc:, stroke, strokewidth, draw "line…", composite, -compose src-over
bash scripts: cyclical repeat, cyclical, multipleadditions
Moving rotation
Script using affine to rotate a sequence 360 degrees and move it across the screen.
Requires installation of the affinerotate script from imagemagick.
commands: repage, affine, transform, compose copy, compose, crop, background, flatten
bash scripts: cyclical repeat, cyclical, decimaladdtotal, multiple additions
Superman swirl
Script using affine to rotate an animation 360 degrees and flip it head over tails. Like the Phantom Zone in Superman II.
Requires the installation of the affinedistort script for imagemagick.
commands: affine, transform, crop, background, flatten
bash scripts: cyclical repeat, cyclical, decimaladdtotal, trueloop
Corridor
Script distorting the perspective of two animations and appending them.
commands: matte, virtual-pixel background, background, distort perspective, virtual-pixel transparent, composite
bash scripts: cyclical
Hard compose
Script laying one image over another using the compose command difference.
Difference: Subtracts the darker of the two constituent colors from the lighter. Painting with white inverts the destination color. Painting with black produces no change.
commands: compose difference, crop, composite
bash scripts: cyclical
Rotate over background
Combine rotating image with composed background.
commands: resize, compose difference, composite, repage, affine, transform, compose copy, compose src-over, flatten
bash scripts: decimaladdtotal, multiple additions, renumbering loop
Requires installation of the affinerotate script from imagemagick.
Three arguments must be given for this script:
./rotate+bg folder1/ folder2/ folder3/
The first two folders containing the images that will make up the background and the third the images that will twirl across the foreground.
Swirl implode
Swirl-implode from one animation to another.
commands: swirl, implode, compose, border, shave, bordercolor, compose src-over, composite
bash scripts: renumbering loop, sequentialnumberfeed
Integrating Fred's imagemagick scripts
Fred's ImageMagick Scripts by Fred Weinhaus offers a myriad of bash scripts for Imagemagick. Some of them are for creating animations albeit only with single still images. These are my first attempt at altering these scripts so the series of images can be animated.
3Drotate animation
As the name suggests an animation is rotated in 3D. Here is the site describing the 3Drotate which rotates the individual images. It must be downloaded and installed into a valid path:
http://www.fmwconcepts.com/imagemagick/3Drotate/index.php
Further down in the same page you'll find the animation script which I have adapted to allow for series of images.
commands: delay, page, virtual-pixel, background, distort, perspective
bash scripts: checksize, cyclical, floating point removal, decimal add total variable
Pseudocolor
Images must be grayscale. A rainbow-colored lookup table is used to color in the images. The colors which substitute the various shades of gray changes through the animation. Based on a script found at Fred's ImageMagick Scripts
commands: size, xc:, channel, seperate, colorspace HSB, compose copyred, compose copygreen, compose copy blue, composite, colorspace RGB, rotate, roll, -clut
bash scripts: cyclical, nestedtrueloop
3D box
This script creates an array of boxes which rotate. 3 animations run on the sides of the boxes. The script 3DBox must be installed in a valid path.
There's a problem with imagemagick that you can't create the box when it is shown at or near a right angle. How near to a right angle the image can be depends on its size. There is a noticeable skip in the rotation because these images have to be left out.
There's also the problem that this script overheats my laptop. Strangely it doesn't overheat my powermac. Use with caution.
commands: append
bash scripts: renumbering loop, divisorchooser
wipe
PURPOSE: To apply an animated transition between two sets of images.
DESCRIPTION: WIPE applies an animated transition between two sets of images using a mask image to control the transition. The first set of images will show where the mask is black and the second set of images will show where the mask is white. The mask will be made gradually more an more white as each frame is composited. NOTE that this is not a true warping morph. It is simply an animated masked composite.
fxwipe
PURPOSE: To create an animated transition between two image sequences using a special effect distortion.
DESCRIPTION: FXWIPE creates an animated transition between two images sequences using a special effect distortion. The special effects distortions include: blur, explode, implode, pixelize, recursion, spin, spread, swirl, zoomin and zoomout.
todo
other
http://www.imagemagick.org/Usage/anim_mods/
aliasing virtual-pixel mirror displacement maps compositing different colors differently convert marzahn.png \( +clone -channel G -fx 'cos(pi*(i/w-.5))' -separate \) -fx 'p{v*w,j}' test.png http://www.fmwconcepts.com/imagemagick/pinbarrel/
Date: 2009-08-22 15:36:37 CEST
HTML generated by org-mode 6.24b in emacs 22