• Скрипт для порезки слоёв по гриду в Photoshop?

    @Petrovich_Z
    Ну не ахти какой код, но вроде работает. Накидал на скорую руку.
    Первые две строки определяют размер ячейки.

    var cellWidth = 60;
    var cellHeight = 60;
    
    if (app.documents.length <= 0) {
        alert("No open documents");
    }
    else {
        try {
            var docRef = app.activeDocument;
            var layerCount = docRef.layers.length;
            var layerSetsCount = docRef.layerSets.length;
            var docWidth = docRef.width;
            var docHeight = docRef.height;
    
            var stepW = Math.ceil(docWidth / cellWidth);
            var stepH = Math.ceil(docHeight / cellHeight);
    
            var layerName = "";
            var layerCount = docRef.artLayers.length;
            var insertLayer;
            var newLayerCount = 0;
    
            for (j = 0; j < layerCount; j++) {
                for (h = 0; h < stepH; h++) {
                    for (w = 0; w < stepW; w++) {
                        docRef.activeLayer = docRef.artLayers[j + newLayerCount];
                        layerName = docRef.activeLayer.name;
                        insertLayer = docRef.activeLayer.duplicate(docRef, ElementPlacement.PLACEATBEGINNING);
                        docRef.activeLayer = insertLayer;
                        docRef.selection.select([
                            [w * cellWidth, h * cellHeight],
                            [(w + 1) * cellWidth, h * cellHeight],
                            [(w + 1) * cellWidth, (h + 1) * cellHeight],
                            [w * cellWidth, (h + 1) * cellHeight]
                        ]);
                        docRef.selection.invert();
                        docRef.selection.clear();
                        insertLayer.name = layerName + "_" + h.toString() + "_" + w.toString();
                        newLayerCount++;
                    }
                }
            }
        } catch (e) {
            alert(e);
        }
    }