Animation merger

0. Contents

This is the documentation of animmerger-1.1.0.
   1. Purpose
   2. Pixel methods
      2.1. Static methods
         2.1.1. AVERAGE
         2.1.2. MOSTUSED
         2.1.3. LAST
      2.2. Animated methods
         2.2.1. CHANGELOG
         2.2.2. LOOPINGLOG
   3. Usage
   4. Copying
   5. Requirements
   6. Downloading

1. Purpose

Animmerger.
Motion detection.
Overlap.

2. Pixel methods

Original animation As a sample, here is the original animation (712100 bytes).

The animation was created literally by taking a screenshot from the NES emulator every frame.
(I hacked the emulator to automatically produce a screenshot after every frame.)

What follows below, is a list of the pixel methods supported by animmerger,
along with example images demonstrating what that pixel method does.

The -m0,8,256,16,020202,A64010,D09030,006E84,511800,FFFFFF
parameter was given to animmerger to remove the HUD that is 256x16 wide
and begins at 0,8. The hexadecimal numbers listed are these colors:
020202 A64010 D09030 006E84 511800 FFFFFF
This removes the text (white) as well as the blinking coin.

To be exact, here is the list of commands used to generate these pictures.

# Produce the "original" gif from the screenshots (png files produced by the emulator)
(mkdir pano3/q; cd pano3/q
ln ../*.png . ; mogrify -format gif *.png
gifsicle -O2 -o ../../demo/original.gif -l0 -d3 *.gif)

# Produce the static pictures
for s in a l m;do (mkdir $s;cd $s ; ../animmerger -p$s ../pano3/*.png -m0,8,256,16,020202,A64010,D09030,006E84,511800,FFFFFF;
mv tile-0000.png ../demo/method-$s.png;
cd ../demo; pngout-hard method-$s.png)&done &> /dev/null

# Produce the changelog animation
for s in c;do (mkdir $s;cd $s ; rm tile-????.???; ../animmerger -l30 -p$s ../pano3/*.png -m0,8,256,16,020202,A64010,D09030,006E84,511800,FFFFFF;
mogrify -format gif tile-*.png ;
gifsicle -O2 -o ../demo/method-$s.gif -l0 -d3 tile-*.gif)&done &>/dev/null

# Produce the loopinglog animations (vary the loop length)
for l in 4 10 30;do (mkdir o;cd o ; rm tile-????.???; ../animmerger -l$l -po ../pano3/*.png -m0,8,256,16,020202,A64010,D09030,006E84,511800,FFFFFF;
mogrify -format gif tile-*.png ;
gifsicle -O2 -o ../demo/method-ol"$l".gif -l0 -d3 tile-*.gif);done &>/dev/null

# Produce the changelog animation without HUD removal
for s in c;do (mkdir $s;cd $s ; rm tile-????.???; ../animmerger -l30 -p$s ../pano3/*.png ;
mogrify -format gif tile-*.png ;
gifsicle -O2 -o ../demo/method-t$s.gif -l0 -d3 tile-*.gif)&done &>/dev/null

2.1. Static methods

2.1.1. AVERAGE

The "average" method produces a "motion blur" effect of the entire input, reducing it into a single frame.

Average

You can see a faint trace of all animated actors that appeared in the animation. Mario moved very fast so his trace is quite difficult to spot.

2.1.2. MOSTUSED

The "most used" method produces what might be the background image for the entire animation.

Most used

Note: If there is an actor that sits in a certain location for a long time, it is also recorded.
In this example, there were none though.
This mode does not thus remove all actors, but it does remove anything that wanders around.

2.1.3. LAST

The "last" method is a simpler implementation of the "most used" method, simply recording the last pixel value in any location.

Last

2.2. Animated methods

2.2.1. CHANGELOG

The "changelog" method records the entire animation (121995 bytes in this example).
It takes considerably less disk space (and network bandwidth) than the original animation, because now the background does not scroll.

Changelog

You see some artifacts in the turtle and in Mario when they appear near the top of the screen. This is because they were behind the HUD (the text "WORLD 8-2" for instance), which was removed.
In the case of the turtle, the turtle's white pixels were also removed, because the HUD removal was based on color as well as coordinates.
Horizontal disappearance of the actors is because of the viewport scrolling past them. They do not exist outside those parameters in the original animation either.

Here is how the animation looks like, if the HUD is not removed. (246643 bytes)

Changelog, with HUD intact

Exteriors, i.e. content outside the "current" viewport of the animation are colored as in the "most used" pixel method.
This is evident in the trails left by the HUD as it scrolls by at different speeds.

2.2.2. LOOPINGLOG

The "loopinglog" method records the entire animation, but reuses existing frames. Use the -l option to set the loop length in frames.
The smaller value you use, the shorter the animation is in the number of frames, but the more pronounced is the "lemmings" effect.

30 frames (99755 bytes):
Loop, 30 frames

10 frames (73850 bytes):
Loop, 10 frames

4 frames (49890 bytes):
Loop, 4 frames

3. Usage

animmerger v1.0.1 - Copyright (C) 2010 Joel Yliluoma (http://iki.fi/bisqwit/)

Usage: animmerger [<options>] <imagefile> [<...>]

Merges animation frames together with motion shifting.

 --help, -h             This help
 --mask, -m <defs>      Define a mask, see instructions below
 --method, -p <mode>    Select pixel type, see below
 --looplength, -l <int> Set loop length for the LOOPINGLOG mode
 --version, -V          Displays version information

animmerger will always output PNG files into the current
working directory, with the filename pattern tile-####.png
where #### is a sequential number beginning from 0000.

AVAILABLE PIXEL TYPES

  AVERAGE, long option: --method=average , short option: -pa
     Produces a single image. Each pixel
     is the average of all frames addressing that pixel.
  LAST, long option: --method=long , short option: -pl
     Produces a single image. Each pixel
     records the latest color addressing that pixel.
  MOSTUSED, long option: --method=mostused, short option: -pm
     Produces a single image. Each pixel
     records the color that most often occured in that location.
     Use this option for making maps!
  CHANGELOG, long option: --method=changelog, short option: -pc
     Produces an animation.
  LOOPINGLOG, long option: --methods=loopinglog, short option: -po
     Produces a time-restricted animation.
     Also called, "lemmings mode".
     Use the -l option to set loop length in frames.

DEFINING MASKS

  You can use masks to block out HUD / splitscreens
  so that it will not intervene with the animation.
  To define mask, use the --mask option, or -m for short.
  Mask syntax: x1,y1,width,height,colors
  Examples:
    -m0,0,256,32
       Mask out a 256x32 wide section at the top of screen
    -m0,0,256,32,FFFFFF
       From the 256x32 wide section at the top of screen,
       mask out those pixels whose color is white (#FFFFFF)
    -m16,16,8,40,000000,483D8B
       From the 8x40 wide section at coordinates 16x16,
       mask out those pixels whose color is either
       black (#000000) or dark slate blue (#483D8B)

TIPS

Converting tile-*.png into a GIF animation:
   mogrify -format gif tile-????.png
   gifsicle -O2 -o animation.gif -l0 -d3 tile-????.gif

Converting a GIF animation into individual frame files:
   gifsicle -U -E animation.gif
   animmerger <...> animation.gif.*

4. Copying

nesmock has been written by Joel Yliluoma, a.k.a. Bisqwit,
and is distributed under the terms of the General Public License (GPL).

5. Requirements

GNU make and C++ compiler is required to recompile the source code.
libgd is also required.

6. Downloading

The official home page of animmerger is at http://iki.fi/bisqwit/source/animmerger.html.
Check there for new versions.

Additionally, the most recent source code (bleeding edge) for animmerger can also be downloaded by cloning the Git repository by:

Generated from progdesc.php (last updated: Fri, 30 Jul 2010 02:30:31 +0300)
with docmaker.php (last updated: Fri, 30 Jul 2010 02:30:31 +0300)
at Fri, 30 Jul 2010 02:30:31 +0300