Color match/reduction across all pixel character's frames


Hi Guys,

Got a bit of an issue here that hopefully one of you can help solve. I've come up with a solution that works but is problematic. Anyway, I'll start with the problem.

Our artist hasn't been restricting the use of colors when creating our character frames. The colors are similar but have variants across frames. Basically they are different shades. For example the character standing is 48 colors, but when all movements are combined it's 114, yet looks the same. We should be able to reduce the colors to 64 across the board to save memory and for consistency and other reasons I won't go into detail here.

The problem is how to do this? We have around 200 frames per character as separate PNG files. The colors need to be consistent across all the files. Is there a program or method to automate this?

This is the method I have come up with:

1. Import all frames of character to photoshop as frame animation
2. Save for web as a GIF and reduce colors to 128 or 64 as needed.
3. Reimport GIF file to photoshop. Export the frames as PNG's.
4. Use tinypng or PNGoo to optimise the PNG file size.

The big issue here is that the frames will not keep their naming conventions. It will no longer be "standing001.png" etc. for each action which adds a lot of work going through and renaming each set of animations.
Comments3
Join the community to add your comment. Already a deviant? Log In
electricjonny's avatar
Do you need any transparency (or rather, semi-transparency) in the images?  I assume not since you're converting to gif files then resaving as png.

I made a quick action that saves the file (click new action, save for web & devices, set to PNG-8 at 64 colors, save, stop action).  So you can try that, then go to File -> Automate -> Batch, then select the action you just made, select the folder of images, (might override the open command), then pick a new folder to save as and keep the file name the same.

The only issue is you might need to record the action and pick a specific color palette with 64 colors (since using the default 64 color option will revise the palette for each image, not use the same 64 colors across all images), and I didn't play with that much, but it should be possible (if you look at the Export dropdown in your action, you should see a bunch of things and be able to double click to edit (I think?  Not sure since I don't use actions much).



Anyway, it sounds like the above answer would be easier, although you'd have to put Python on your computer and use that imaging library, then I don't know if it uses a single color palette across all images.

I would just do it all within Photoshop, by recording an action and then using the batch automation feature with that action.  Just might take a few attempts to make sure you record it right, using a specific color palette.
TheGuyInATie's avatar
Get Python Imaging Library, then run the following function
result = image.convert('P', palette=Image.ADAPTIVE, colors=64)