Gif to sprite sheet?

Place to get help with not working mods / modding interface.
Bizobinator
Fast Inserter
Fast Inserter
Posts: 193
Joined: Fri May 06, 2016 10:35 pm
Contact:

Gif to sprite sheet?

Post by Bizobinator »

How do I turn a gif into a sprite sheet? Or, rather, a series of images into a sprite sheet (instead of using Blender and the Python script)?
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Gif to sprite sheet?

Post by darkfrei »

Bizobinator wrote:How do I turn a gif into a sprite sheet? Or, rather, a series of images into a sprite sheet (instead of using Blender and the Python script)?
https://www.imagemagick.org/script/comm ... essing.php
You can read more than one image from a sequence with a frame range. For example, you can extract the first four frames of an image sequence:

Code: Select all

magick 'images.gif[0-3]' images.mng
Optionally, use an embedded formatting character to write a sequential image list. Suppose our output filename is

Code: Select all

image-%d.jpg
and our image list includes 3 images.
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Gif to sprite sheet?

Post by bobingabout »

I do it by hand.

I also use an obscure old piece of software called Paint shop pro, so, if I described exactly, features I use might not exist in your program.

Basically... I find out what the minimum size the sprite needs to be so the entire thing fits in an un-moving rectangle, then that's my size
I then set a grid to the size of this grid.
Count how many sprites there are, and figure out their arangements. if it needs to be 8 frames wide, I create a blank sheet which is 8 times the width of a sprite wide. Similar calculation for height.
then... pick up the first image, drop it in the top left corner. pick up the second, and drop it in the space to it's right... making sure the top left pixel lines up to the top left pixel in my grind. The grid is purely part of the GUI, so isn't saved when I save the image.

and so on.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
Bizobinator
Fast Inserter
Fast Inserter
Posts: 193
Joined: Fri May 06, 2016 10:35 pm
Contact:

Re: Gif to sprite sheet?

Post by Bizobinator »

bobingabout wrote:I do it by hand.

I also use an obscure old piece of software called Paint shop pro, so, if I described exactly, features I use might not exist in your program.

Basically... I find out what the minimum size the sprite needs to be so the entire thing fits in an un-moving rectangle, then that's my size
I then set a grid to the size of this grid.
Count how many sprites there are, and figure out their arangements. if it needs to be 8 frames wide, I create a blank sheet which is 8 times the width of a sprite wide. Similar calculation for height.
then... pick up the first image, drop it in the top left corner. pick up the second, and drop it in the space to it's right... making sure the top left pixel lines up to the top left pixel in my grind. The grid is purely part of the GUI, so isn't saved when I save the image.

and so on.

I'm trying out this method, but I've had a snag (again with the picture out of bounds).

Code: Select all

filename = "__mlg_factorio__/graphics/air-horn-action.png",
     priority = "extra-high",
     width = 640,
     height = 640,
     frame_count = 100,
     line_length = 10,
     animation_speed = 1,
Are the width & height parameters meant to be per each individual frame, or are they for the total sprite sheet?
The sprite sheet I'm using is 10x10 chunks, with each sprite meant to be 64x64.
User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: Gif to sprite sheet?

Post by Arch666Angel »

it's width and height per frame
Post Reply

Return to “Modding help”