Subtracting 1 pixel from outline of every frame in animated gif

Alec Jacobson

May 01, 2012

weblog/

When I overlay animations on background images there's often a a thin outline of white or near white coming from the texture mapping + anti-aliasing in my application.

worm animation with correct transparency over clouds

I came up with two easy ways to get around this in photoshop. First just add a black stroke to every frame. This works well for cartoons:

worm animation with stroke

The other option is very similar. Add a stroke to each layer but instead of "adding" the stroke color, subtract it from the image. Select the blending options in the stroke layer style to look like this:

photoshop subtract stroke layer style

which produces something like: worm animation subtract stroke