0

いくつかの調整を実行し、画像を保存して閉じるスクリプトを作成しました。

preferences.rulerUnits = Units.PIXELS;
imageWidth = activeDocument.width.as('px');
imageHeight = activeDocument.height.as('px')-30;
activeDocument.resizeCanvas(imageWidth,imageHeight,AnchorPosition.TOPCENTER);
app.activeDocument.save();
app.activeDocument.close();

これを画像のフォルダー全体で実行する方法はありますか?

ありがとう

4

1 に答える 1

1

次のようなことを試すことができます:

#target photoshop
#strict on

main();
function main()
{
    var path = "/d/Images/";

    var inputFolder = new Folder(path );
    var inputFiles = inputFolder.getFiles("*.*");

    for(index in inputFiles)
    {
        // open the file
        var fileToOpen = new File(inputFiles[index]);
        open(fileToOpen);

        // do the processing
        preferences.rulerUnits = Units.PIXELS;
        imageWidth = activeDocument.width.as('px');
        imageHeight = activeDocument.height.as('px')-30;
        activeDocument.resizeCanvas(imageWidth,imageHeight,AnchorPosition.TOPCENTER);
        app.activeDocument.save();
        app.activeDocument.close();

    }
}

私は試していませんが、うまくいくはずです。それが役に立てば幸い。

于 2012-01-16T16:43:20.057 に答える