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

Run a script to execute an action on several JPGs + custom text in each image

New Here ,
Jun 21, 2017 Jun 21, 2017

Hello!

I am an actor headshot photographer, and I format my headshots to have white borders and the actors name. I currently create a new 8x10 at 300DPI. I then use an action in Photoshop CC (latest version) that prompts me to open a jpg, then it resizes the headshot (the headshot itself is 4:6 aspect ratio) to leave a white border, and it adds my name at the bottom of the image. I go in and I change the name to my subject's name. I then export the final result. The final product looks like this:

Example.jpg

I would like to automate this so that way I can select multiple images at a time, input the actor's name once, and have Photoshop spit out the files into a specified folder. Is this possible with a script, and if so, can anyone help me out with that? TIA!

TOPICS
Actions and scripting
3.6K
Translate
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 ,
Jun 21, 2017 Jun 21, 2017

Why would you want to have and automated process that requires human intervention to enter Names.   You could easily add the name you want to the image files in some way like Filename or in the image's metadata info.   The Automated process could then be fully automated and even batched.  If all you need is a is a border around a single image a specific size and a name in the border it should be easy to automate.

Filenames, a simple frame template and a batch script could do it all.

The sample video does not show the File name stamp that could be done with my  Script BatchOneImageCollage. In my

Photo Collage Toolkit

Photoshop scripting is powerful and I believe this package demonstrates this A video showing a 5 image collage PSD template  being populated with images:

The package includes four simple rules to follow when making Photo Collage Template PSD files so they will be compatible with my Photoshop scripts.

  1. Size the photo collage templates for the print size you want - width, height and print DPI resolution.
  2. Photo collage templates must have a Photoshop background layer. The contents of this layer can be anything.
  3. Photo collage templates must have alpha channels named "Image 1", "Image 2", ... "Image n".
  4. Photo collage templates layers above the background layers must provide transparent areas to let the images that will be placed below them show through.

There are fifteen scripts in this package they provide the following functions:

  1. HelpPhotoCollageToolkit.jsx - Online Help
  2. TestCollageTemplate.jsx - Used to test a Photo Collage Template while you are making it with Photoshop.
  3. CollageTemplateBuilder.jsx - Can build Templates compatible with this toolkit's scripts.
  4. LayerToAlphaChan.jsx - Used to convert a Prototype Image Layer stack into a template document.
  5. InteractivePopulateCollage.jsx - Used to interactively populate Any Photo Collage template. Offers most user control inserting pictures and text.
  6. ReplaceCollageImage.jsx - use to replace a populated collage image Smart Object layer with an other image correctly resized and positioned.
  7. ChangeTextSize.jsx - This script can be used to change Image stamps text size when the size used by the populating did not work well.
  8. PopulateCollageTemplate.jsx - Used to Automatically populate a Photo Collage template and leave the populated copy open in Photoshop.
  9. BatchOneImageCollage.jsx - Used to Automatically Batch Populate Collage templates that only have one image inserted. The Collage or Image may be stamped with text.
  10. BatchMultiImageCollage.jsx - Used to Automatically Batch Populate Any Photo Collage template with images in a source image folder. Easier to use than the interactive script. Saved collages can be tweaked.
  11. PasteImageRoll.jsx - Paste Images into a document to be print on roll paper.
  12. BatchPicturePackage.jsx - Used to Automatically Batch Populate Any Photo Collage template with an image in a source image folder.  Images Rotates for best fit.
  13. BatchPicturePackageNoRotate.jsx - Used to Automatically Batch Populate Any Photo Collage template with an image in a source image folder.
  14. PopulatePicturePackage.jsx - Used to Automatically populate a Photo Collage template Fill with the same single image and leave the populated copy open in Photoshop.
  15. PCTpreferences.jsx - Edit This File to Customize Collage Populating scripts default setting and add your own Layer styles.

Documentation and Examples

JJMack
Translate
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
Community Expert ,
Jun 21, 2017 Jun 21, 2017

All you may need to do is name the Portrait files  if your satisfied their composition and the images are portraits with aspect ratios near 2:3. and create the 8x10 300 DIP Photo collage template PSD that just need a White Background Layer  and an Alpha Channel the maps the 4x6 Image location name "Image 1". That should require a few minuets to create with Photoshop most likely less then 5.

Capture.jpg

JJMack
Translate
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
New Here ,
Jun 21, 2017 Jun 21, 2017

Am I able to have the text exactly like I have it in my example image? (same font, positioning, etc. I can send you the action) And is it possible to have the script not output PSD files?

Translate
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
Community Expert ,
Jul 21, 2019 Jul 21, 2019

We did something like that were I used to work. We used a script to automate formatting our images. I would suggest, as JJ, mentioned that you put the actor's name in the file's metadata - caption or description, for example. You can do a whole batch of images at one time, so not much typing. The the script runs and pulls the info from the metadata, adds the border, and saves as jpgs. Here's an example of what we were doing: company logo in the upper left, description - from metadata in the upper right, file name and date shot in the lower right, and a header.

Translate
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
Community Expert ,
Jul 21, 2019 Jul 21, 2019

Are you currently entering the actor's name as metadata? If not as metadata, what about the filename or folder name?

The "obvious/correct" place to enter this is in the IPTC Extension – Person Shown field

ExifTool:

XMP-iptcExt:PersonInImage

Adobe:

<Iptc4xmpExt:PersonInImage>

            <rdf:Bag>

               <rdf:li>Firstname Surname</rdf:li>

            </rdf:Bag>

</Iptc4xmpExt:PersonInImage>

However, it may be "easier" to use the Subject/Keyword field or another more accessible field if the PersonInImage field proves hard to work with.

______________________________

EDIT: Off the top of my head, there are three possibilities so far –

1) Use/Adapt JJMack's BatchOneImageCollage script

2) Create a script to run your action and then process the action output using script functions that are not available to actions (i.e. variable metadata text)

3) Entirely recreate your action as a script so that there is no dependency for having the action loaded

Translate
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
LEGEND ,
Jul 23, 2019 Jul 23, 2019
LATEST

You can invoke a script from within an action.

The script below formats the filename (removing the file extension), puts that into a new text layer, and sets the location and font formatting. You could modify it to read a metadata field or to accept input from a dialog box instead of using the filename.

--------------------------------

#target photoshop

testText();

function testText(){

    if(documents.length > 0){

        var originalDialogMode = app.displayDialogs;

        app.displayDialogs = DialogModes.ERROR;

        var originalRulerUnits = preferences.rulerUnits; //save previous ruler units

        preferences.rulerUnits = Units.PIXELS;

        try{

            var docRef = activeDocument;

            var LayerRef = docRef.artLayers.add(); //add a text layer

            LayerRef.kind = LayerKind.TEXT;

            var TextRef = LayerRef.textItem;

            var fileNameNoExtension = docRef.name;

            fileNameNoExtension = fileNameNoExtension.split('.');

            if(fileNameNoExtension.length > 1){ //remove file extension

                fileNameNoExtension.length--;

                }

            fileNameNoExtension = fileNameNoExtension.join('.');

            TextRef.contents = fileNameNoExtension;

            TextRef.position = new Array(80, 120); //location in pixels

            preferences.rulerUnits = Units.POINTS;

            TextRef.size = 96; //text formatting

            TextRef.useAutoLeading = false;

            TextRef.leading = 42;

            TextRef.font = 'Calibri-Bold';

            }

        catch(e){

            preferences.rulerUnits = originalRulerUnits;

            app.displayDialogs = originalDialogMode;

            return;

            }

        preferences.rulerUnits = originalRulerUnits;

        app.displayDialogs = originalDialogMode;

        }

    else{

        alert('You must have a document open to run this script.');

        return;

        }

    }

Translate
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