Hey PS-Scripts, figured I would Introduce myself since I'm new here. My name is Genel Jumalon I am currently working on a game titled Survivors of Ragnarok. I use CS4 for creating all my art assets for the game.
I figured I would ask in case something had been made to save time. I need to replace a selection of colors on an exact pixel level when I export to video as a folder of .png files. I need to to be able to change the hair colors of my dwarfs that won't require me to respectively recolor them by hand.
Normally this wouldn't be a problem but there is a HUGE number of animations in the game. Everything from simple walk animations to more complicated ones like climbing and various combat animations.
As you can see the amount of animations and frames per animation is very time consuming. Not to mention that the sword and shield are each on separate individual layers and need to be recolored also. Is there any script that would allow me to easily select 3 or so colors from my .pdf file and replace it with 3 colors I choose when I export to video?
-Genel Jumalon
Per Pixel Color Replacement
Per Pixel Color Replacement
Bonjour Tastyrice
I'm not sure of having all understood but you can try this script :
Code: Select all//Changer 3 couleurs dans chaque calque
//ChangeCouleur.jsx
var docRef = app.activeDocument;
var layerCount = docRef.layers.length;
docRef.activeLayer.visible = false
oldColor = new Array;
newColor = new Array;
for ( var i=0 ; i<3 ; i++ )
{
oldColor = new SolidColor();
newColor = new SolidColor();
}
oldColor[0].rgb.hexValue = "b4bee1"; //couleurs a modifier
newColor[0].rgb.hexValue = "e1c6b4";
oldColor[1].rgb.hexValue = "e0e6e7";
newColor[1].rgb.hexValue = "b0754e";
oldColor[2].rgb.hexValue = "cad2e4";
newColor[2].rgb.hexValue = "f7d8c4";
for (var j = layerCount; j > 0; j--) //selection des calques
{
activelayer = docRef.layers[j-1];
docRef.activeLayer = docRef.layers[j-1];;
activelayer.visible = true;
changeColor();
activelayer.visible = false;
}
activelayer.visible = true;
function changeColor()
{
for ( var i=0 ; i<3 ; i++ )
{
selectColorRange( oldColor );
activeDocument.selection.fill( newColor )
activeDocument.selection.deselect()
}
}
function selectColorRange(scObj){
var desc = new ActionDescriptor();
desc.putInteger( charIDToTypeID( "Fzns" ), 0 );
var cDesc = new ActionDescriptor();
cDesc.putDouble( charIDToTypeID( "Rd " ), scObj.rgb.red);
cDesc.putDouble( charIDToTypeID( "Grn " ), scObj.rgb.green);
cDesc.putDouble( charIDToTypeID( "Bl " ), scObj.rgb.blue );
desc.putObject( charIDToTypeID( "Mnm " ), charIDToTypeID( "RGBC" ), cDesc );
desc.putObject( charIDToTypeID( "Mxm " ), charIDToTypeID( "RGBC" ), cDesc );
executeAction( charIDToTypeID( "ClrR" ), desc, DialogModes.NO );
}
I'm not sure of having all understood but you can try this script :
Code: Select all//Changer 3 couleurs dans chaque calque
//ChangeCouleur.jsx
var docRef = app.activeDocument;
var layerCount = docRef.layers.length;
docRef.activeLayer.visible = false
oldColor = new Array;
newColor = new Array;
for ( var i=0 ; i<3 ; i++ )
{
oldColor = new SolidColor();
newColor = new SolidColor();
}
oldColor[0].rgb.hexValue = "b4bee1"; //couleurs a modifier
newColor[0].rgb.hexValue = "e1c6b4";
oldColor[1].rgb.hexValue = "e0e6e7";
newColor[1].rgb.hexValue = "b0754e";
oldColor[2].rgb.hexValue = "cad2e4";
newColor[2].rgb.hexValue = "f7d8c4";
for (var j = layerCount; j > 0; j--) //selection des calques
{
activelayer = docRef.layers[j-1];
docRef.activeLayer = docRef.layers[j-1];;
activelayer.visible = true;
changeColor();
activelayer.visible = false;
}
activelayer.visible = true;
function changeColor()
{
for ( var i=0 ; i<3 ; i++ )
{
selectColorRange( oldColor );
activeDocument.selection.fill( newColor )
activeDocument.selection.deselect()
}
}
function selectColorRange(scObj){
var desc = new ActionDescriptor();
desc.putInteger( charIDToTypeID( "Fzns" ), 0 );
var cDesc = new ActionDescriptor();
cDesc.putDouble( charIDToTypeID( "Rd " ), scObj.rgb.red);
cDesc.putDouble( charIDToTypeID( "Grn " ), scObj.rgb.green);
cDesc.putDouble( charIDToTypeID( "Bl " ), scObj.rgb.blue );
desc.putObject( charIDToTypeID( "Mnm " ), charIDToTypeID( "RGBC" ), cDesc );
desc.putObject( charIDToTypeID( "Mxm " ), charIDToTypeID( "RGBC" ), cDesc );
executeAction( charIDToTypeID( "ClrR" ), desc, DialogModes.NO );
}