Created
November 22, 2011 10:29
-
-
Save moluapple/1385381 to your computer and use it in GitHub Desktop.
PS_Split Channels to Files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (){ | |
var op = new TiffSaveOptions; | |
op.imageCompression = TIFFEncoding.TIFFLZW; | |
app.documents.length == 1 && splitChannels (activeDocument); | |
function splitChannels (doc) { | |
var fn = doc.name, | |
fp = doc.path, | |
md = doc.mode, | |
base = fn.replace(/\.\w{2,4}$/, ''), | |
F = function (doc, i){ | |
doc.saveAs(File(fp + '/' + base + '-' + i + '.tif'), op); | |
doc.close(SaveOptions.DONOTSAVECHANGES); | |
}, | |
i = null; | |
// 下面这行适用于CS5 版,CS2试试改为: executeAction(charIDToTypeID( "Opn " ), new ActionDescriptor(), DialogModes.NO); | |
executeAction(charIDToTypeID( "SplC" ), new ActionDescriptor(), DialogModes.NO); | |
i = app.documents.length; | |
if (md == DocumentMode.CMYK) { | |
for (; --i > -1; F(app.documents[i], i > 3 ? i + 1 : [2,3,4,1][i])); | |
} else if (md == DocumentMode.MULTICHANNEL) { | |
for (; --i > -1; F(app.documents[i], i + 1)); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment