Hey there. What you want to do isn’t actually that difficult, but you are doing two things at once, so pay attention:
The sprite proxy
Press NK0 to look through the camera. Click somewhere inside the camera view (it doesn’t matter exactly where) so that the 3D Cursor is there. Add a plane and TAB back to Object Mode. Switch to another view where you can see both the camera and the plane you just added. (I would take the time to name the plane something useful, like “Sprite Image”.)
Select first the plane, then the camera, and press Ctrl-P to make the Camera the parent of the plane. (This way you can do whatever you like to the camera and the plane stays where you put it in the view.)
Now press NK0 again. Scale the plane to the appropriate size. Remember that its dimensions should match the aspect ratio of the images you will use. Next grab it and place it in the lower-left corner of the view. If your intended target is display on a computer then the edges of the plane should align with the edges of the outermost dotted line of the camera.
Insert a LocRot key. Now adjust the current frame index to the end of your animation (frame 24), move the plane to where it should end, and insert another LocRot key.
(You may want to test the movement of the plane, insert additional keyframes, adjust IPO curves, interpolation mode, etc. --the usual stuff.)
Select the plane. Press F5 for the Material Buttons and add a new material. Enable Full OSA, ZTransp, and Shadeless. Right next to the ZTransp button is ZOffs. Give it a ZOffs value of 10.000 (the maximum). This is important to keep your sprite in front of everything else you render in your scene!
Now, over on the right add a new texture. Press F6 for the Texture Buttons. Select your texture type as Image. Enable the UseAlpha and Clip buttons.
Load the very first sprite image (“0001.png”). Then click the Sequence button. (This is a nifty new feature.) For Frames enter the number of images (in your example, it is 0001.png to 0024.png, so frames would be 24). StartFr is the frame at which to begin playing the animation. If the number of images and the number of frames the images have to fill don’t match, you can play with the Fie/Ima field, but I recommend that things just match to begin with (you’ll get better results).
Hope I didn’t miss anything.
Wait, apparently I missed the forum… You want to write a script to do this?
You are going to have to do some pixel-by-pixel twaddling. I direct you here. Good luck!