Getting many external images into one

Hi,
I’m creating a bunch of sprites, so I render an animation say 24 frames long, then stick them into one image 1st frame in bottom left going across then up, highest number in top right. This image can then be used with the Anim and tiles setting in the real time properties for UV.

What I want to do is get images from a directory named 0001.png, 0002.png, etc and put them all into one image in order

is there a script for this in existence or can someone give me pointers on how to go about writing one?

Thanks!

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.)

Sprite Texture
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.

[edit]
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!

Hey Duoas,

thanks for your reply! I must have done a terrible job at explaining myself :o- you have very clearly explained something that I’m not trying to do…! :eek:

I am simply trying to combine many different images into one big image. there is a script that does this in blender for all images that a mesh has for UVs, I want to use many images from the same directory and stick them together in order.

Can anyone give me any pointers in this? I hope this is clear this time…

Ah, so you just want a collage, something like a checkerboard where each ‘square’ is one of your original images…

Yes, you can do it in bpython, but AFAIK only pixel by pixel. You’d have an easier time just doing it in Photoshop or GIMP.

Good luck.

Yes! That’s it exactly! Does anyone know a way to set this up in GIMP then? (or Blender - even rendering pixel by pixel would be faster than putting the images together manually)

Hi! ImageMagick is your best friend for jobs like this. The “montage” command is what you are looking for.
To tile your 24 images in a 6x4 grid into a file called montage.png you’d use something like

montage -tile 6x4 -geometry +0+0 *.png montage.png

More examples can be found in the docs.
Hope it helps!