Category Archives: Gamedev

Extracting separate tiles from the tilesheet

When programming my game, I have encountered a following problem and had a bit of a struggle with it:

There are whole 2d tilesheets, available on the internet, the good example is the free tilesheet collection, kindly published by hyptosis:

http://hyptosis.newgrounds.com/news/post/793230

However, what if I want to get the separate tiles from them? (I.e, for my map editor, which takes single tiles). The need to split the whole tilesheet into single tiles arises.

The solution is quite simple:

  1. Take the spritesheet that you need. In my case, it has been http://www.newgrounds.com/art/view/hyptosis/tile-art-batch-1 – download to  your computer
  2. Download and install ImageMagick, http://www.imagemagick.org/script/index.php
  3. Run the following command:
    convert -crop 32x32 source.png tile%d.png
  4. 
    

    Voila. You have your tiles split into separate images. Now you can separate your spritesheets into smaller frames in the same way.

Source: http://stackoverflow.com/questions/4761365/i-have-a-1024×1024-png-i-want-to-split-it-into-64×64-256-equal-parts