i want to split channel(file)....every file must save as "File + channel name.tif"...
exmple:
file nae is jy001
channel 1 name is bl
channel 2 name is cl
channel 3 name is kl
after split channel atuo save as jy001-bl.tif/jy001-cl.tif/jy001-kl.tif(total 3 files)
pls help me
help! save split channel
-
pfaffenbichler
help! save split channel
Does this help?
Code: Select all// 2013, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
var thePath = myDocument.path;
var basename = myDocument.name.match(/(.*)\.[^\.]+$/)[1];
var theNumber = myDocument.channels.length;
try {
// split;
// =======================================================
var idSplC = charIDToTypeID( "SplC" );
var desc2 = new ActionDescriptor();
executeAction( idSplC, desc2, DialogModes.NO );
// save files;
for (var m = 0; m < theNumber; m++) {
var thisDocument = app.activeDocument;
var thisName = thisDocument.name;
var thisPath = thePath+"/"+basename+thisName.slice(thisName.lastIndexOf("_"), thisName.length)+".tif";
saveAsTif (thisDocument, thisPath);
thisDocument.close();
}
}
catch (e) {}
};
////// save tif //////
function saveAsTif (myDocument, thePath) {
// tif options;
tifOpts = new TiffSaveOptions();
tifOpts.embedColorProfile = true;
tifOpts.imageCompression = TIFFEncoding.TIFFLZW;
tifOpts.alphaChannels = false;
tifOpts.byteOrder = ByteOrder.MACOS;
tifOpts.layers = false;
// save copy;
myDocument.saveAs((new File(thePath)), tifOpts, false);
};
Code: Select all// 2013, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
var thePath = myDocument.path;
var basename = myDocument.name.match(/(.*)\.[^\.]+$/)[1];
var theNumber = myDocument.channels.length;
try {
// split;
// =======================================================
var idSplC = charIDToTypeID( "SplC" );
var desc2 = new ActionDescriptor();
executeAction( idSplC, desc2, DialogModes.NO );
// save files;
for (var m = 0; m < theNumber; m++) {
var thisDocument = app.activeDocument;
var thisName = thisDocument.name;
var thisPath = thePath+"/"+basename+thisName.slice(thisName.lastIndexOf("_"), thisName.length)+".tif";
saveAsTif (thisDocument, thisPath);
thisDocument.close();
}
}
catch (e) {}
};
////// save tif //////
function saveAsTif (myDocument, thePath) {
// tif options;
tifOpts = new TiffSaveOptions();
tifOpts.embedColorProfile = true;
tifOpts.imageCompression = TIFFEncoding.TIFFLZW;
tifOpts.alphaChannels = false;
tifOpts.byteOrder = ByteOrder.MACOS;
tifOpts.layers = false;
// save copy;
myDocument.saveAs((new File(thePath)), tifOpts, false);
};
-
roychen
help! save split channel
pfaffenbichler wrote:Does this help?
Code: Select all// 2013, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
var thePath = myDocument.path;
var basename = myDocument.name.match(/(.*)\.[^\.]+$/)[1];
var theNumber = myDocument.channels.length;
try {
// split;
// =======================================================
var idSplC = charIDToTypeID( "SplC" );
var desc2 = new ActionDescriptor();
executeAction( idSplC, desc2, DialogModes.NO );
// save files;
for (var m = 0; m < theNumber; m++) {
var thisDocument = app.activeDocument;
var thisName = thisDocument.name;
var thisPath = thePath+"/"+basename+thisName.slice(thisName.lastIndexOf("_"), thisName.length)+".tif";
saveAsTif (thisDocument, thisPath);
thisDocument.close();
}
}
catch (e) {}
};
////// save tif //////
function saveAsTif (myDocument, thePath) {
// tif options;
tifOpts = new TiffSaveOptions();
tifOpts.embedColorProfile = true;
tifOpts.imageCompression = TIFFEncoding.TIFFLZW;
tifOpts.alphaChannels = false;
tifOpts.byteOrder = ByteOrder.MACOS;
tifOpts.layers = false;
// save copy;
myDocument.saveAs((new File(thePath)), tifOpts, false);
};
hi pfaffenbichler
i test but can't find channel name! ....only file name+ 1 (2.3.4....)
i need file name + channel name
such as :
file name is a
channel 1 name is 1A,channel 2 name is 2B,channel 3 is kl,.....after split channel save file,file name is a-1A.tif ,a-2B.tif ,a-kl.tif ,don't a-1.tif , a-2.tif etc...
Code: Select all// 2013, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
var thePath = myDocument.path;
var basename = myDocument.name.match(/(.*)\.[^\.]+$/)[1];
var theNumber = myDocument.channels.length;
try {
// split;
// =======================================================
var idSplC = charIDToTypeID( "SplC" );
var desc2 = new ActionDescriptor();
executeAction( idSplC, desc2, DialogModes.NO );
// save files;
for (var m = 0; m < theNumber; m++) {
var thisDocument = app.activeDocument;
var thisName = thisDocument.name;
var thisPath = thePath+"/"+basename+thisName.slice(thisName.lastIndexOf("_"), thisName.length)+".tif";
saveAsTif (thisDocument, thisPath);
thisDocument.close();
}
}
catch (e) {}
};
////// save tif //////
function saveAsTif (myDocument, thePath) {
// tif options;
tifOpts = new TiffSaveOptions();
tifOpts.embedColorProfile = true;
tifOpts.imageCompression = TIFFEncoding.TIFFLZW;
tifOpts.alphaChannels = false;
tifOpts.byteOrder = ByteOrder.MACOS;
tifOpts.layers = false;
// save copy;
myDocument.saveAs((new File(thePath)), tifOpts, false);
};
hi pfaffenbichler
i test but can't find channel name! ....only file name+ 1 (2.3.4....)
i need file name + channel name
such as :
file name is a
channel 1 name is 1A,channel 2 name is 2B,channel 3 is kl,.....after split channel save file,file name is a-1A.tif ,a-2B.tif ,a-kl.tif ,don't a-1.tif , a-2.tif etc...
-
pfaffenbichler
help! save split channel
In my test it named the resulting files correctly (the original name and the channel’s name).
Could you post a screenshot of the list of files?
Could you post a screenshot of the list of files?
-
roychen
help! save split channel
pls download http://pan.baidu.com/share/link?shareid ... 2249681349 ... 2249681349
-
pfaffenbichler
help! save split channel
On my computer the names do not get clipped.
Could you try changing the path to
Code: Select allvar thisPath = thePath+"/"+basename+thisName.slice(thisName.lastIndexOf("_"))+".tif";
to see if that makes a difference?
Could you try changing the path to
Code: Select allvar thisPath = thePath+"/"+basename+thisName.slice(thisName.lastIndexOf("_"))+".tif";
to see if that makes a difference?
-
pfaffenbichler
help! save split channel
I can’t reproduce the issue so you best trouble-shoot it yourself.
If you split the Channels manually do the resulting files have the full channel names as part of their names (even though they are unsaved)?
If you split the Channels manually do the resulting files have the full channel names as part of their names (even though they are unsaved)?