• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Watermarking with filenames

New Here ,
Jan 03, 2022 Jan 03, 2022

Copy link to clipboard

Copied

I need to export previews from shoots with watermarks of the filenames. It's a simple step in Capture One apparently, but I can't seem to be able to find a straight forward way to do this in Camera Raw, Photoshop, or Lightroom? Am I missing something or does Adobe just not get this need from photographers? Thank you!

TOPICS
macOS

Views

369

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jan 03, 2022 Jan 03, 2022

Copy link to clipboard

Copied

LATEST

I made some rough edits to a script that I hacked last year for another photographer.

 

This is a draft starting point, without knowing how the watermark should look. If you can provide a before and after image sample then this can be refined.

 

 

/* 
https://community.adobe.com/t5/photoshop-ecosystem-discussions/watermarking-with-filenames/td-p/12632295
Draft version 0.1
Stephen Marsh, 4th January 2022
*/

#target photoshop

function waterMarker() {

    if (documents.length > 0) {

        // Save the original dialog display
        var originalDialogMode = app.displayDialogs;
        app.displayDialogs = DialogModes.ERROR;
        // Save the original ruler units
        var originalRulerUnits = app.preferences.rulerUnits;
        // Set the working units
        app.preferences.rulerUnits = Units.PIXELS;
        // Save the original resolution
        var originalRes = app.activeDocument.resolution;
        // Set the working resolution
        app.activeDocument.resolution = 72;

        try {

            /*
            // Add copyright metadata
            // Escaped copyright symbol = \xA9
            app.activeDocument.info.copyrighted = CopyrightedType.COPYRIGHTEDWORK;
            app.activeDocument.info.copyrightNotice = "Copyright \xA9 by ME!";
            */

            // add a text layer
            var LayerRef = app.activeDocument.artLayers.add();
            LayerRef.kind = LayerKind.TEXT;
            var textRef = LayerRef.textItem;

            var fileNameNoExtension = app.activeDocument.name.replace(/\.[^\.]+$/, '');

            textRef.contents = fileNameNoExtension;

            textRef.position = new Array(0, 0);
            app.preferences.rulerUnits = Units.POINTS;
            textRef.size = 30;
            textRef.useAutoLeading = false;
            textRef.leading = 25;
            textRef.font = 'Times-Italic';
            textRef.justification = Justification.CENTER;
            var textColor = new SolidColor;
            textColor.rgb.red = 255;
            textColor.rgb.green = 255;
            textColor.rgb.blue = 255;
            textRef.color = textColor;

            app.preferences.rulerUnits = Units.PIXELS;

            // Blend mode
            app.activeDocument.activeLayer.blendMode = BlendMode.DIFFERENCE;

            // Opacity
            app.activeDocument.activeLayer.opacity = 100;

            // Conditional resize layer by portrait or landscape orientation
            if (app.activeDocument.height > app.activeDocument.width) {
                scaleP();
            } else {
                scaleL();
            }

            // Rotate text -45 degrees
            app.activeDocument.activeLayer.rotate(-45, AnchorPosition.MIDDLECENTER);

            // Reset the original settings
            app.preferences.rulerUnits = originalRulerUnits;
            app.displayDialogs = originalDialogMode;
            app.activeDocument.resolution = originalRes;

            function scaleP() {
                var iLayer = app.activeDocument.activeLayer;
                app.activeDocument.activeLayer = iLayer;
                var scale = Math.min(app.activeDocument.width / (iLayer.bounds[2] - iLayer.bounds[0]), app.activeDocument.width / (iLayer.bounds[3] - iLayer.bounds[1]));
                // Scale to 90% of canvas
                iLayer.resize(scale * 90, scale * 90);
                // Centre the text layer on canvas
                iLayer.translate(app.activeDocument.width / 2 - (iLayer.bounds[0] + iLayer.bounds[2]) / 2, app.activeDocument.height / 2 - (iLayer.bounds[1] + iLayer.bounds[3]) / 2);
            }

            function scaleL() {
                var iLayer = app.activeDocument.activeLayer;
                app.activeDocument.activeLayer = iLayer;
                var scale = Math.min(app.activeDocument.width / (iLayer.bounds[2] - iLayer.bounds[0]), app.activeDocument.height / (iLayer.bounds[3] - iLayer.bounds[1]));
                // Scale to 90% of canvas
                iLayer.resize(scale * 90, scale * 90);
                // Centre the text layer on canvas
                iLayer.translate(app.activeDocument.width / 2 - (iLayer.bounds[0] + iLayer.bounds[2]) / 2, app.activeDocument.height / 2 - (iLayer.bounds[1] + iLayer.bounds[3]) / 2);
            }

        } catch (e) {
            // Reset the original settings
            app.preferences.rulerUnits = originalRulerUnits;
            app.displayDialogs = originalDialogMode;
            app.activeDocument.resolution = originalRes;

            return;
        }
    }
}

// Create a single history step
app.activeDocument.suspendHistory("Watermarker Script", "waterMarker()");

 

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines