2 Responses

  1. […] set GIMP up to make Spritesheets, I followed this really useful guide. The gist of it is that you can copy the code that’s in there, paste it in a blank Notepad […]

  2. Eneko
    | Reply


    First, thank you so much for this! I had an animated GIF created in Synfig that I couldn’t accurately convert to a spritesheet and your plugin got it almost there and helped me figure out the problem.

    I tried with ImageMagick’s montage command to no avail. When it was not resizing each frame differently, it was moving them and the resulting spritesheet animation was always wrong.

    When I tried your plugin I was pleased because there was no resizing whatsoever and everything looked in order. However after trying it in Unity I notice a slight unwanted movement, and after scratching my head for a while I realized the layers of this animated GIF have all different sizes that extend only to their contents but not to the whole image size.

    So with that in mind I tried one of Ofnuts’ plugin to resize all layers to image size: ofn-layers-to-image-size.zip from https://sourceforge.net/projects/gimp-tools/files/scripts/ and indeed everything went smooth.

    However I also needed my spritesheet dimensions to be a power of 2 and the default resulting spritesheet arrangement was overflowing already 4096 on the width while it was barely the half for the height as the original image isn’t square.

    So I decided to add fields to indicate the width and height in cells of the spritesheet and to resize the layers (so that I never forget to do it before), and that’s exactly what I did!

    I added a versatile way to indicate columns and rows, so that you can indicate both, any or none. Both would create a fixed grid of said size. Any would calculate the remaining dimension size in order to fit all the images. None falls back to the default behavior. So in my case I had 48 layers and an image width of 640 so I knew I wanted 6 columns in order to not overflow the 4096 pixels width, so I can just enter 6 and let the rows be calculated.

    As for the layers size and offset I kept these values before resizing to fit the image and restored them after, so that no one will be unhappy about their original layers being changed 🙂

    I pasted the resulting code here for ease of use: https://pastebin.com/2FPk66jG
    It’s also obviously on my GitHub fork: https://github.com/ecv80/scripts

    Cheers and thanks again for this.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.