Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I need to generate a sprite sheet with squared sprite for a 2D game. How can I generate a sprite sheet where each frame has x = y? The only think I have to do is to "insert" some blank space between sprites (in case y were > x in the original sprite). Is there any program that I can use to trasform "irregular" sprite sheets to "squared" sprite sheets?

An example of non-squared sprite sheet: http://spriters-resource.com/gameboy_advance/khcom/sheet/1138

share|improve this question
    
If you're using XNA: xbox.create.msdn.com/en-US/education/catalog/sample/… –  Justin Skiles Sep 17 '12 at 17:28
    
Thanks, but I'm developing in java! –  Andrea Tucci Sep 17 '12 at 17:33
add comment

3 Answers 3

up vote 6 down vote accepted

ImageMagick's montage command can do this. For example, to compile a bunch of irregular-sized sprites into a sheet of 32 × 32 pixel tiles, you can do:

montage sprite*.png  -geometry "32x32>+0+0"  -background none  sheet.png

The -geometry "32x32>+0+0" option above will resize all the sprites to 32 × 32 pixels (adding transparent space around smaller images and scaling down any that are too large) and tile them with 0 pixel gaps between them. (The double quotes are there to keep the shell from interpreting the > as an output redirection command.)

By default, montage will try to create a "squarish" sheet with roughly as many rows as columns. If you'd prefer, say, a single-column strip, add the option -tile 1x after the -geometry "32x32>+0+0". If you want the sheet to have a solid color background, change the none to a color specifier (e.g. white or "#ffffff" for white).

share|improve this answer
    
Great! This is what I'm searching for, thank you. But I have a little issue: I write -geometry 59x59 because the biggest 'x' value is 59, but what I get is this : s8.postimage.org/e59ul5akl/sheet.png . As you can see, all the sprites are resized to 59x59, is it possible to maintain the orignal values and only add some blank space?(so all the sprite has their original values, but with blank spaces their'll be squared on the sheet!) –  Andrea Tucci Sep 18 '12 at 9:59
    
I tried this: "montage frame*.png -background none -tile 8x sheet.png" and it creates a sprite sheet with normal sized sprites where they are also squared :) Thank you very much, this is a powerful tool! –  Andrea Tucci Sep 18 '12 at 10:51
1  
@Andrea: If you write -geometry "59x59>", the > makes montage only scale sprites that are bigger than 59 × 59 pixels. –  Ilmari Karonen Sep 18 '12 at 11:18
add comment

I don't know of a specific program, but there are some steps you can take to use whatever program you like.

  1. Get the sprites as individual images. You may already have them in that format, or you'll want to export them as such from whatever program you're using.

  2. Parse the images to find their max dimension (x or y).

  3. Pad the images with whitespace or transparency, using the maximum dimension you found in step 2 as the x and y. Most paint tools have functionality like this, and some allow automation of tasks like this.

  4. Generate a sprite sheet with your new square images. Pick your favorite sprite sheet generator and make sure it doesn't trim out the borders.

share|improve this answer
add comment

You might have some luck with SpriteVortex.

From the CodePlex page:

Sprite Vortex aims to greatly reduce the time needed to create frame based sprite animations. It covers common and useful operations such as importing a spritesheet, building spritesheet from separate images , cutting frames, building animations and more. Developed in: C#.

share|improve this answer
    
Yes I've already seen it, but it detects the sprites.. so it exports them with irregular dimensions! –  Andrea Tucci Sep 17 '12 at 17:35
    
@AndreaTucci, Have you tried exporting with the square format option checked? If not, try under Options -> Exporting. There is an option called Force Square Format. I think that might do what you want... –  Cypher Sep 17 '12 at 17:42
    
Yes, I've tried but it means that the entire sprite sheet has a square format! (and trying it, nothing changed) –  Andrea Tucci Sep 17 '12 at 18:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.