Life can be colorful! Each cell in a life-like cellular automaton only needs one bit to represent it since it can only be alive or dead. That means there are only two colors; pretty boring.
Normal images have 24 bits per pixel (8 in each of R G B). This means in a normal image with pixels as cells you could simulate 24 life-like games at once!
Challenge
Your task is to write a program that will apply one generation of the rules of a life-like cellular automaton to a 24-bit depth image (in any well known format you like), and output the resulting image.
Each of the 24 layers will use the same life-like ruleset, strictly within it's own layer. The 24 layers do not interact with each other.
Also

Zeros are dead cells and ones are live cells.
Boundary conditions are periodic (forming a torus).
Any image dimensions should work.

Input/Output
Your program needs to take in 3 arguments, via stdin or command line (or your language's closest equivalent):

The name of the input image file.
A string of the digits 0 to 8 in increasing order that denotes when new cells are born:

If the digit d is in the string then dead cells come alive when they have d living neighbors.
Example: 3 is normal Life - Dead cells with exactly 3 living neighbors come to life.


A string of the digits 0 to 8 in increasing order that denotes when existing cells survive:

If the digit d is in the string then living cells with d living neighbors survive to the next generation, otherwise they die.
Example: 23 is normal Life - Only cells with exactly 2 or 3 neighbors survive to the next round.



Note that the Moore neighborhood is always used. Read this or this for more info on what precisely defines a life-like automaton and many interesting rulesets.
The 1-generation-later output image should either be displayed or saved as out.png (or bmp or whatever).
Submission
The shortest code in bytes wins.
You are required to include at least one test image and its three immediate subsequent generations for some non-trivial ruleset. Use your avatar and the normal Life rules if you can't think of anything better.
If you like you may use this Gosper Glider Gun where the only living bits are in the green 128 layer (it's only sure to work in normal Life):

Posting interesting sequences or even animations is highly encouraged.
MATLAB: 275

My favorite of the parameters I tried is 45678, 568 which following a gradual disintegration results in a sky of twinkling stars.
This image depicts, "the disintegration of the persistence of memory."



Ungolfed gif-producing code (accepts PNG without extension):

B = input('B', 's') - 48;
S = input('S', 's') - 48;
f0 = input('file: ', 's');
frames = 60;

f = sprintf('%s.png',f0);
fout = sprintf('%s.gif',f0);
first = 1;
img = imread(f);
for i = 1:60
    out = img * 0;
    [r, c, turd] = size(img);
    for b=0:7
        bimg = ~~bitand(img,2^b);
        pimg = [bimg,bimg,bimg;bimg,bimg,bimg;bimg,bimg,bimg];
        fun = @(ro,co) pimg(r+ro:r+r+ro-1,c+co:c+c+co-1,:);
        sum = fun(0,0)+fun(0,1)+fun(0,2)+fun(1,0)+fun(1,2)+fun(2,0)+fun(2,1)+fun(2,2);
        bnew = uint8(bimg &amp; ismember(sum,S) | ~bimg &amp; ismember(sum, B));
        out = out + 2^b * bnew;
    end
    %imwrite(out,'out.png');
       if first
           [img1,img2] = rgb2ind(img,256);
           imwrite(img1,img2,fout,'gif','Loop',Inf);
          imwrite(img1,img2,fout,'gif','WriteMode','append');
           first = 0;
       end
       img = out;
       [img1,img2] = rgb2ind(img,256);
       imwrite(img1,img2,fout,'gif','WriteMode','append');%,'DelayTime', 2*delay);
end


Golfed code that accepts a full filename (which can be GIF, JPEG, and perhaps other stuff) and writes to out.png:

I=@()input('','s');B=I();S=I();i=imread(I());o=0;[r,c,t]=size(i);for b=0:7
g=~~bitand(i,2^b);p=repmat(g,3);F=@(z,Z)p(r+z:r+r+z-1,c+Z:c+c+Z-1,:);M=@(A)ismember(F(0,0)+F(0,1)+F(0,2)+F(1,0)+F(1,2)+F(2,0)+F(2,1)+F(2,2),A-48);o=o+2^b*uint8(g&amp;M(S)|~g&amp;M(B));end
imwrite(o,'out.png')


A previously discovered fact is that parameters 12, 1 can be used to generate a Sierpinski carpet-like fractal. Here is one with a randomly placed seed point in each bit: