Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Batch process command - recolor entire folder of sprites

A topic by Lily Valeen created 6 days ago Views: 79
Viewing posts 1 to 1

Hi there! Thank you so much for this tool - it saved me a ton of work :)

I found myself needing to run this tool across an entire game project's worth of art several times, to fix some palette inconsistencies I made early on. As far as I can tell this functionality doesn't exist yet within the GUI, but I wrote a Windows .bat file that more or less does exactly that, so thank you for making the command-line tool available! I'm attaching the script contents here in case this helps anyone else.

To use:

  • set the "ppt" variable to the location of PixelPaletteTool.exe
  • set the "swapfile" variable to the full path & filename of the swap file you're using
    • this is generated by using the GUI to set up your color swaps and then using the "Save" button near the word "View"
  • set the location of your input directory
  • set the location of your output directory
  • save the following script into a Windows .bat file and run

Running this script will a palette swap every .png file in the input directory and save the result in the output directory, following the same folder structure.

SCRIPT
---

@echo off
setlocal

set "ppt=C:\path\PixelPaletteTool.exe"
set "swapfile=C:\path\swapfile.txt"
set "inputdir=C:\path\inputdirectory"
set "outputdir=C:\path\outputdirectory"

for /R "%inputdir%" %%F in (*) do (
     for %%i in ("%%F") do (
        if %%~xi==.png (
            if not exist "%outputdir%%%~pi" ( mkdir "%outputdir%%%~pi" )
            %ppt% -i "%%F" -o "%outputdir%%%~pi%%~ni.png" -s "%swapfile%"
        )
    )
)

@pause