[Guide] Making spritesheets with Blender

Place to post guides, observations, things related to modding that are not mods themselves.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 1877
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [Guide] Making spritesheets with Blender

Post by darkfrei » Sun Dec 11, 2016 10:37 pm

Also, for spritify you can use this tool: Just insert yours sprites and start the .bat-file what you need or make the new one.
Factorio_IMagick.7z
(5.18 MiB) Downloaded 81 times
Make this code, then it's not crop sprite at 128 pixels anymore. And it makes one sprite sheet with 8 columns.

Code: Select all

montage "Sprites/file*.png" -geometry +0+0 -tile 8x -background rgba(0,0,0,0) -quality 100% Sprite_x_8x.png
With 8 raws:

Code: Select all

montage "Sprites/file*.png" -geometry +0+0 -tile x8 -background rgba(0,0,0,0) -quality 100% Sprite_x_x8.png

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 1877
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [Guide] Making spritesheets with Blender

Post by darkfrei » Wed Jan 17, 2018 9:45 pm

If your sprites have too big alpha border, it can be cropped with this script:

Code: Select all

magick "Input/*.png" -background none ^
   ( -clone 0--1 -layers merge ^
   -set option:cropper "%%[@]" +delete ) ^
   -crop %%[cropper] +repage ^
   MIFF:- | magick montage MIFF:- -background none ^
   -tile 2x2 -geometry +0+0 Output\best_spritesheet_2x2.png
Examples, code from this forum, a lot of thanks to GeeMack.

Pros: You are cut all alpha from sprites, so your spritesheet will have much tiny dimensions. All sprites have same dimensions, no pixel with graphics will be deleted.
How to use: place your sprites to Input folder and start .bat-file.
Factorio_IMagick_best_spritesheet.7z
Example
(5.03 MiB) Downloaded 45 times
Code for rotating clockwise 90 degree.

Code: Select all

magick "Input/*.png" -background none ^
   -rotate 90 ^
   Input/rotated_90_%%04d.png
Mirroring

Code: Select all

magick "Input/*.png" -background none ^
   -flop ^
   Input/flop_%%04d.pnge

User avatar
JesseDGamer
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Jul 26, 2018 12:59 am
Contact:

Re: [Guide] Making spritesheets with Blender

Post by JesseDGamer » Thu Jul 26, 2018 2:42 am

For people having trouble when trying to generate the sprite sheet, specifically when blender can't find the "montage.exe" file, here's a fix I did.
I replaced line 121 in the spritify.py file with the full path + file name of the montage.exe that ImageMagick installed :

Code: Select all

"C:\Program Files\ImageMagick-7.0.8-Q16\montage.exe",
where it used to be

Code: Select all

"montage",
Idk for sure, but I think it has something to do with environment variables or something.

My problem now is that it's removing transparency from all the output images no matter what color I choose for the background... I've done a little research and found it might be a bug with montage.exe. Idk.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 1877
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [Guide] Making spritesheets with Blender

Post by darkfrei » Thu Jul 26, 2018 5:20 am

JesseDGamer wrote:My problem now is that it's removing transparency from all the output images no matter what color I choose for the background... I've done a little research and found it might be a bug with montage.exe. Idk.
Don't forget this part:

Code: Select all

-background none

User avatar
Oceanel
Burner Inserter
Burner Inserter
Posts: 12
Joined: Tue Aug 12, 2014 9:58 am
Contact:

Re: [Guide] Making spritesheets with Blender

Post by Oceanel » Mon Oct 22, 2018 10:59 am

darkfrei wrote:
Wed Jan 17, 2018 9:45 pm
If your sprites have too big alpha border, it can be cropped with this script:

Code: Select all

magick "Input/*.png" -background none ^
   ( -clone 0--1 -layers merge ^
   -set option:cropper "%%[@]" +delete ) ^
   -crop %%[cropper] +repage ^
   MIFF:- | magick montage MIFF:- -background none ^
   -tile 2x2 -geometry +0+0 Output\best_spritesheet_2x2.png
How to use: place your sprites to Input folder and start .bat-file.
Factorio_IMagick_best_spritesheet.7z
...

Thanks, very helpful!

Add more:
If you want like this
fi-basic-farmland_07_4x.jpg
fi-basic-farmland_07_4x.jpg (209.37 KiB) Viewed 353 times
Use such code:

Code: Select all

magick "Input/*.png" -background none ^
   ( -clone 0--1 -layers merge ^
   -set option:cropper "481x337+328+315" +delete ) ^
   -crop %%[cropper] +repage ^
   MIFF:- | magick montage MIFF:- -background none ^
   -tile 2x2 -geometry +0+0 Output\best_spritesheet_2x2.png
pause

And, for making icon 128x128 use this:

Code: Select all

magick "Input/*.png" -background none ^
   ( -clone 0--1 -layers merge ^
   -set option:cropper "%%[@]" +delete ) ^
   -crop %%[cropper] +repage ^
   MIFF:- | magick convert MIFF:- -background none ^
   -adaptive-resize 128x128 -gravity center -extent 128x128 best_icon_128b.png
pause
transparent background supported.
best_icon_128b.png
best_icon_128b.png (22.44 KiB) Viewed 347 times

Post Reply

Return to “Modding discussion”

Who is online

Users browsing this forum: No registered users