Try to keep the sprites in a consistent grid, preferably in sizes that are divisible by 8 (not required).
Actually, video cards just love it when your textures' sizes are powers of 2 (many of them even refuse to work otherwise). By extension, sprites are usually made with "good" sizes too, though latter is not that necessary.
This is related to how video cards process these textures. Let's say... it's just a lot easier when you can cleanly divide by 2 all the way down to 1.
Sometimes you are allowed to load non-good textures as well, but it's often done with a whole spectrum of limitations and drawbacks. For example, D3DX, when is asked to load a texture from a wrong-sized file, creates a good-sized bitmap in memory and then resizes the input image to the target bitmap that way so, when drawn with original image size, original picture is reproduced. Though, when used with sprites, this technique may introduce some nasty artifacts.
Here's an example. I have created
two textures, the first one being of good 8*8 size, and the second one being ill 12*12. Then, I asked Direct3D to draw left-topmost 4*4 regions of both textures.
Here's how it looks with the good texture. We see exactly what we intended to show.
Here's how the bad texture works. Colors from neighboring regions flood into our sprite. Why does it happen? Because, during loading, D3DX resized our 12*12 image to 16*16 texture, so texels' boundaries are no longer where we wanted them - instead of whole 4 texels we see about 5.3 of them which correspond to our desired region.
To add more clarity,
here the full texture is shown. As we see, it's size is actually 16*16, not 12*12 as we originally intended. Though, if I put this texture on a 12*12px square, I would get the original image.
To make the point more evident, it this example I used a rather large size for sprites and effectively disabled magnification filtering, so we can clearly see the boundaries of texels. Still, even with default linear filter and near 1 pixel-to-texel ratio, we still can see this color flooding artifact near our sprites' borders.
However, as I said earlier, nothing stops us from putting arbitrary-sized sprites in a good-sized image. Still, traditionally, the whole texture is usually divided into a right grid, which makes individual regions to have power-of-two sizes as well.
As an example,
here is a sprite sheet from guess what. As you see, 256*256 texture is divided into 4*4 grid, making each region 64*64px in size. [UPD] oh wait what that's 4*3 grid, okay, bad example, imagine this one was never mentioned
[/UPD]
Here is another sheet from the same game. Some of the grid cells are further divided to make space for smaller objects.
As for the whole texture size, it's usually 256*256, though I remember creating several huge 4096*2048 texture for some bitmap Unicode font. They weren't all loaded at once, though.
So, that's how sprite sheets are made in real good games. :3
P. S.
You are welcome.