Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Create strip from image sequence

Participant ,
Oct 02, 2008 Oct 02, 2008
I need a script or action, or droplet or something that will take a folder of images and create One Image strip from it. Basically I have animations I have rendered out as frames that I need to put in a game. The game needs the images in one file with all the images side by side (or on top of each other I think) The frames are all one size (but different for each sequence) It takes about 4 hours for me to do this now. And then if it has to change it's four more hours...

Any thoughts idease or techniques?

C
TOPICS
Actions and scripting
21.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Valorous Hero ,
Feb 05, 2009 Feb 05, 2009
yes
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
I thought so...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
BTW, for save... it seems there is no simple format option for "export: save for web and devices" as there is under AppleScript?

It seems you made (a seemingly quite complicated, and probably very good) script to add this missing functionality?

If I use the normal save/saveas with PNG, am I am going to have the save dialog popping up and asking me for additional info manually? This occurs when saving as PNG under AppleScirpt.... So I use saveForWeb instead.... but it seems to be missing in the JavaScipt docs...

confusing...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
seems like some functions are available and AppleScript but missing under JavaScript, and vice versa.... seems you have to pict and choose the parts you need and use both to get a full process done...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 27, 2009 Jul 27, 2009

It is possible to "save for web" by using ExportOptionsSaveForWeb. I have provided an example of its usage on my blog in a post titled Photoshop “save for web” JavaScript.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Feb 05, 2009 Feb 05, 2009
You can save a PNG with..


function SavePNG(savefile){
pngSaveOptions = new PNGSaveOptions();
pngSaveOptions.embedColorProfile = true;
pngSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
pngSaveOptions.matte = MatteType.NONE;
pngSaveOptions.quality = 1;
pngSaveOptions.PNG8 = false
pngSaveOptions.transparency = true;
doc.saveAs(savefile, pngSaveOptions, true, Extension.LOWERCASE);
}

but for Save for Web it would need scriptlistener code.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
where does the file name come from for this function?

Can we auto-name the file as (selectedFolder + ".png" ) ?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Feb 05, 2009 Feb 05, 2009
No that would try to create a filename of the path.
what you would need is something on the lines of..


var saveFile = decodeURI(selectedFolder);
saveFile= saveFile.substring((saveFile.lastIndexOf('/')+1));
saveFile = new File(selectedFolder+'/'+saveFile+'.png');
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
awesome! I really appreciate the help! thanks!

that goes in the function or in the body of the code?

can you insert this save function and name formating into your last full code example, so I can see the full proper syntax of the complete code example (for processing a single folder--not batch...)?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Feb 05, 2009 Feb 05, 2009
Here is your code with the save added..


#target photoshop

/////////////////////////////////////////////////////////////////////////////////////////////////

app.preferences.rulerUnits = Units.PIXELS;

app.preferences.typeUnits = TypeUnits.PIXELS;

//////////////////////////////////////////////////////////////////////////////////////////////////



selectedFolder = Folder.selectDialog( "Please select input folder");

var saveFile = decodeURI(selectedFolder).replace(selectedFolder.parent,'');

saveFile = new File(selectedFolder+saveFile+'.png');

var fileList = selectedFolder.getFiles();

for(var aFile = 0; aFile<fileList.length;aFile++){

var file = fileList[aFile];

if(file instanceof File && file.name.match(/\.png$/i)){



open(file);



////////////////////////////////////////Add Extra Boarder Stripe to maintain relative positon

var Width =activeDocument.width.value;

var Height =activeDocument.height.value;

activeDocument.resizeCanvas(Width+2, Height, AnchorPosition.MIDDLECENTER)

var Width =activeDocument.width.value;

var Height =activeDocument.height.value;

var fillColor = new SolidColor;

fillColor.rgb.hexValue = '000000';

activeDocument.selection.select([[0,0],[1,0],[1,Height],[0,Height]], SelectionType.REPLACE, 0, false);

activeDocument.selection.fill(fillColor, ColorBlendMode.NORMAL, 100, false );

activeDocument.selection.deselect();

activeDocument.selection.select([[(Width-1),0],[Width,0],[Width,Height],[(Width-1),Height]], SelectionType.REPLACE, 0, false);

activeDocument.selection.fill(fillColor, ColorBlendMode.NORMAL, 100, false );

activeDocument.selection.deselect();

////////////////////////////////////////



if(documents.length > 1){



////////////////////////////////////////Add to Frame Strip

activeDocument.selection.selectAll();

activeDocument.selection.copy();

activeDocument.close(SaveOptions.DONOTSAVECHANGES);

activeDocument = documents[0];

app.activeDocument.resizeCanvas(app.activeDocument.width,app.activeDocument.height+Height, AnchorPosition.TOPCENTER);

activeDocument.paste();

activeDocument.selection.selectAll();

align('AdBt');

app.activeDocument.selection.deselect();

activeDocument.mergeVisibleLayers();

////////////////////////////////////////

}



}else{

continue;

}

}



////////////////////////////////////////Remove Extra Boarder Stripe and Save

var Width =activeDocument.width.value;

var Height =activeDocument.height.value;

activeDocument.resizeCanvas(Width-2, Height, AnchorPosition.MIDDLECENTER)

SavePNG(saveFile);

app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

//////////////////////////////////////////////////////////////////////////////////////////////////

//CUSTOM FUNCTIONS

//////////////////////////////////////////////////////////////////////////////////////////////////



function align(method) {

var desc = new ActionDescriptor();

var ref = new ActionReference();

ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );

desc.putReference( charIDToTypeID( "null" ), ref );

desc.putEnumerated( charIDToTypeID( "Usng" ), charIDToTypeID( "ADSt" ), charIDToTypeID( method ) );

executeAction( charIDToTypeID( "Algn" ), desc, DialogModes.NO );

};

function SavePNG(savefile){

pngSaveOptions = new PNGSaveOptions();

pngSaveOptions.embedColorProfile = true;

pngSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;

pngSaveOptions.matte = MatteType.NONE;

pngSaveOptions.quality = 1;

pngSaveOptions.PNG8 = false

pngSaveOptions.transparency = true;

activeDocument.saveAs(savefile, pngSaveOptions, true, Extension.LOWERCASE);

}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
This this code run for you?<br /><br />It gives me an error:<br /><br /> "Error 8800 General photoshop Error. This functionality may not be available in this version of photohop. <br /><br />-<no additional information available><br />Line: 97<br />"<br /><br />Line 97 is:<br /><br /> activeDocument.saveAs(savefile, pngSaveOptions, true, Extension.LOWERCASE);
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
this this... should be "does this...."
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Feb 05, 2009 Feb 05, 2009
That is strange, just tested it on three seperate folders using PS CS3 and then again with PS CS4
It ran through all without error.
Also I only have 81 lines?

Before the call to save SavePNG(saveFile);
You could add an alert(saveFile); and see if there is something strange happening with the file path and name.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
It seems that the path is being repeated twice in the output name...

so we have "path/path/file.png" instead of "path/file.png"
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Feb 05, 2009 Feb 05, 2009
try changing these lines:

var saveFile = decodeURI(selectedFolder).replace(selectedFolder.parent,'');
saveFile = new File(selectedFolder+saveFile+'.png');


with:-

var saveFile = decodeURI(selectedFolder);
saveFile= saveFile.substring((saveFile.lastIndexOf('/')+1));
saveFile = new File(selectedFolder+'/'+saveFile+'.png');
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
It seems to work fine if I replace:

var saveFile = decodeURI(selectedFolder).replace(selectedFolder.parent,'');
saveFile = new File(selectedFolder+saveFile+'.png');

with simply:

var saveFile = new File(selectedFolder+'.png');
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
so now it works perfectly for one folder...

now, how to automate to process multiple folders... that's the final challenge...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Feb 05, 2009 Feb 05, 2009
But then you won't have a filename to save?
To save the file it needs a full path and file name.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
it seems "selectedFolder" is already giving the full path of the folder.... so all i needed to do was to add the file extension to this.

It works this way here for me on OSX.4.11, CS4.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
now I am testing .getFiles to see if this also reports folders....
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
....and actually it seems it does.... so I think this will work for another loop layer to accomplish batch processing...

though you need to be careful to manually check the "selectedFolder" in this case to be sure it does not contain any files in this dir level.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Feb 05, 2009 Feb 05, 2009
Just tested this and this works recursivly through the folders..


#target photoshop

/////////////////////////////////////////////////////////////////////////////////////////////////

app.preferences.rulerUnits = Units.PIXELS;

app.preferences.typeUnits = TypeUnits.PIXELS;

//////////////////////////////////////////////////////////////////////////////////////////////////



imageFolder = Folder.selectDialog( "Please select input folder");

folderList=[];

if (imageFolder != null) processFolder(imageFolder);

folderList = ReturnUniqueSortedList(folderList)

for(var a = 0;a<folderList.length;a++){

var selectedFolder = folderList;

var saveFile = decodeURI(selectedFolder);

saveFile= saveFile.substring((saveFile.lastIndexOf('/'...































































































































































































Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
yes this works. nice!

one thing. the places the output files inside the subfolder. I would prefer to have them placed at the same level as subfolder.

Otherwise, when processing a large number of folders I will still have to manually go into each one and copy the output files out one at a time.

This is turning into a really nice script though!!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Feb 05, 2009 Feb 05, 2009
just change line 15 and that should do it.

from
saveFile = new File(selectedFolder+'/'+saveFile+'.png');
to
saveFile = new File(folderList[0]+'/'+saveFile+'.png');
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2009 Feb 05, 2009
that seems to output all files into the first subfolder of the folder list
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines