GLOW

mail@pastecode.io avatar
unknown
jsx
21 days ago
2.2 kB
3
Indexable
Never
// GLOW.jsx - A Photoshop Script to Emulate Vintage Film Glow

#target photoshop

function main() {
    if (app.documents.length == 0) {
        alert("No document open. Please open a document and try again.");
        return;
    }

    var doc = app.activeDocument;
    var layers = doc.artLayers;

    // Duplicate the current layer
    var originalLayer = layers[0];
    var layerCopy = originalLayer.duplicate();
    layerCopy.name = "Glow Layer";

    // Apply Gaussian Blur
    layerCopy.applyGaussianBlur(10);

    // Create a new gradient map adjustment layer
    var gradientMap = doc.artLayers.add();
    gradientMap.kind = LayerKind.GRADIENTMAP;
    gradientMap.adjustmentLayer.gradientMap.gradient = app.gradients.getByName("Vintage Film Gradient");

    // Add a vignette effect
    var vignetteLayer = doc.artLayers.add();
    vignetteLayer.kind = LayerKind.SOLIDFILL;
    vignetteLayer.fillColor = new SolidColor();
    vignetteLayer.fillColor.rgb.hexValue = "000000";
    vignetteLayer.opacity = 50;
    vignetteLayer.blendMode = BlendMode.MULTIPLY;
    vignetteLayer.name = "Vignette Layer";

    // Move vignette layer to the bottom
    vignetteLayer.move(doc.artLayers[0], ElementPlacement.PLACEBEFORE);
    
    // Select the ellipse tool to create vignette effect
    var ellipseTool = doc.artLayers.add();
    ellipseTool.name = "Vignette Mask";
    ellipseTool.kind = LayerKind.SOLIDFILL;
    ellipseTool.fillColor = new SolidColor();
    ellipseTool.fillColor.rgb.hexValue = "000000";
    ellipseTool.opacity = 100;
    ellipseTool.blendMode = BlendMode.SCREEN;
    
    // Apply layer mask and create vignette
    var ellipseShape = doc.pathItems.ellipse(0, 0, doc.width.as("px"), doc.height.as("px"));
    ellipseShape.closed = true;
    ellipseShape.fillPath();
    ellipseShape.remove();
    
    // Select the area outside the ellipse for masking
    doc.selection.selectAll();
    doc.selection.invert();
    doc.selection.fill(new SolidColor(), ColorBlendMode.NORMAL, 100, false);
    doc.selection.deselect();

    // Merge all layers
    doc.activeLayer = doc.artLayers[0];
    doc.mergeVisibleLayers();

    alert("Vintage Film Glow effect applied successfully.");
}

main();
Leave a Comment