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

Place images to a specific spot in a template

New Here ,
Sep 29, 2011 Sep 29, 2011

Copy link to clipboard

Copied

I am trying to create an action that will drop images into a specific spot in another document and save it with a certain file name. After the first image is dropped in and saved, I want my next image to do the same and so on. I have all my images cropped to the correct ratio and being pulled from a folder on my desktop. I have my template open in Photoshop where I want my images from that folder to be dropped into. Is this possible?

Any help is greatly appreciated!!

Melissa

TOPICS
Actions and scripting

Views

11.2K

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 ,
Sep 29, 2011 Sep 29, 2011

Copy link to clipboard

Copied

Melissa

What you want to do can be done but it is complex and actions have some limitations and can not use logic without using a script or two. File saving  can be tricky for an action will always save the same file name or use the current document name saved either overwriting the file or saving it to some other particular folder. Action that populate a template can be created but it will always populate the same number of images because an action can not use logic to find out how many spots there are to populate. There are different ways to drop an image into the active document you can paste into an area or just past in the image in as a new layer.  You can also Place images in as smart objects. Each method has some advantages and disadvantages. Layers can also be aligned with selections and layers can be transformed in size.  Your best off creating rule for creating a template and have a plan as to how your going to populate these templates that follow your rules. To protect the template from alteration you may want to dupe the template close the original and work on the duped version. When you dupe the template you can give the dupe a name if you do not name it the new document will have the same name with copy appended.

Scripting is more powerful then Action but they are programs that are written in a scripting language. Photoshop supports three languages. VBS, Applescript and Javascript. Only Javascript is supported on both the MAC and PC platforms.  Even using Javascript you may need to code the script to work on both platforms for I'm sure there are some differences in the OS and file system the may need special handling to work on both platform.  From you description of you work-flow it is hard to tell exactly what you are doing.   If you trying simple create a photo Collage.  You may want to have a look at my free Package for Photoshop called "Photo Collage Toolkit" . I have been told this package works on a MAC but I created it and tested it on widows and got it To work with CS2, CS3, CS4 and CS5.

.

Photo Collage Toolkit UPDATED Sept 24, 2011 added a script to replace a Populated Layered Collage Smart Object Image with an other image with resizing.

Photoshop scripting is powerful and I believe this package demonstrates this.

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

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

  1. TestCollageTemplate.jsx - Used to test a Photo Collage Template while you are making it with Photoshop.
  2. CollageTemplateBuilder.jsx - Can build Templates compatible with this toolkit's scripts.
  3. LayerToAlphaChan.jsx - Used to convert a Prototype Image Layer stack into a template document.
  4. InteractivePopulateCollage.jsx - Used to interactively populate Any Photo Collage template. Offers most user control inserting pictures and text.
  5. ReplaceCollageImage.jsx - use to replace a populated collage image Smart Object layer with an other image correctly resized and positioned.
  6. PopulateCollageTemplate.jsx - Used to Automatically populate a Photo Collage template and leave the populated copy open in Photoshop.
  7. BatchOneImageCollage.jsx - Used to Automatically Batch Populate Collage templates that only have one image inserted. The Collage or Image may be stamped with text.
  8. 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.

Note: Rags Gardner www.rags-int-inc.com Photoshop Collage Template Builder script Copyright (c) 2006 builds layered Photo Collage Template psd files. Rags's has given me permission to include a modified version of his script in my package. The modification converts Rags's layered image template document into a flattened template compatible with Photoshop "Photo Collage Toolkit" package. There is also an option that will instead create a layered image stack like Rags's templates are these are also produced if you attempt to create a template with more then 53 images.

Photoshop only supports up to 53 Alpha channels therefore with its design the Photo Collage Toolkit can only support collages with 1 to 53 images. I do not feel this is a big limitation for if you put 53 3:2 aspect ratio images on a large 16" x 20" paper they would need to be less then 1.9" x 2.86" in size if you wanted a frame around each and less then .95" x 1.43" on a 8" x 10" year book page size.

While the maximum number of images in a collage is 53 you can actually create larger collages by populating a large number of images into several collages and then populate yet an other collage template with these populated collages. Each will be placed into the collage of collages as a single smart object layer. You may want to save the populates PSD file as Jpeg files first to cut down on the overhead of having large PSD file smart object layers in the collage of collages.

Documentation and Examples


JJMack

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
Explorer ,
Jan 29, 2016 Jan 29, 2016

Copy link to clipboard

Copied

Thank you , JJ Mack!!! I have wanted to do this same thing Sara describes - For me I wanted to quickly and easily create Folder Preview Image JPEGs using several images inside of the folder. I was able to easily make an action to resize the images and save them to a folder. But I never fully figured out how to get those images on to my various templates (8 images, 16 images, etc...) and clipped to the masks. Your scripts are magical to me! I am not someone who knows how to script but I knew enough to know this was the best way to achieve what I wanted. Your Tool Kit and postings had great instructions and videos and have made one of my Mac tasks SO simple and such a time saver. THANKS!!

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
New Here ,
Jul 29, 2018 Jul 29, 2018

Copy link to clipboard

Copied

Thank you jjmack... thanks for script...

I modified the Batch Picture package  script for my own... The original script populates single photo to all alpha layers, so i changed a little.

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
Community Expert ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

It good to hear you found  my scripts helpful.   May I ask what you changed my Batch Picture package  script  to do for you?

JJMack

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
Community Expert ,
Sep 30, 2011 Sep 30, 2011

Copy link to clipboard

Copied

Personally I would prefer to use a template with a Smart Object in such a case and Replace Contents.

What formats are the images to be placed, in which format what do you want the layered files saved, where to and with what names exactly?

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
Community Expert ,
Sep 30, 2011 Sep 30, 2011

Copy link to clipboard

Copied

When replacing contents you will have to resize the replaced contents if the replacement image is not the same size and aspect ratio as the smart object contends being replace. There is a transform associated with a smart object layer.  The original smart object layer has a transform associated with it and that transform will be applied to the replacement image.  In fact if you dupe the smart object layer not using new smart object via copy. Just a strait layer dupe you can have several layers all containing the single smart object with each layer having its own transform which locates its position and size. Replacing the content of any of those layers smart object changes the image on all the layers.  For a this type or collage to work correctly the original smart object image and the replacement need to be the same size.  I use Place and smart Object in my Photo Collage Toolkit.   I like to support any size image the only important thing is an image aspect ratios should closely match the aspect ratio of the template image aspect ratio.  They don't have to be same aspect ratio the scripts will fit all image into place but the apparent crop can adversely effect image composition.  Being they are smart objects they can be tweak by retransforming the placed image placement and size.

JJMack

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
Community Expert ,
Oct 01, 2011 Oct 01, 2011

Copy link to clipboard

Copied

Nice explanation for the OP.

And the point you made in post 1 about integrating Scripts into Actions for the steps where Actions alone would fall short is also a valid one – but if in this case the names of the selected file is to be used for saving the new file it might be inconvenient if the selection and the saving would have to be done at two separate points in the Action.

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
Community Expert ,
Oct 01, 2011 Oct 01, 2011

Copy link to clipboard

Copied

Yes with actions you have few options when it come to file nameing.  Scripting is the way to go. 

JJMack

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
Community Expert ,
Sep 30, 2011 Sep 30, 2011

Copy link to clipboard

Copied

Recently I’ve done something similar, so I could adapt that.

On the lower left are the files that were selected in the Script’s dialog (all the same size, though), on the lower right are the resultant images, top center ist the template document with the Smart Object selected.

switchSOPsdScr.jpg

If you want to give it a try, paste the following text into a new file in ExtendScript Toolkit (part of Photoshop’s installation, /Applications/Utilities/Adobe Utilities-CS5/ExtendScript Toolkit CS5) and save it as a jsx-file into Photoshop’s Presets/Scripts-folder.

// replace smart object’s content and save psd;

// 2011, use it at your own risk;

#target photoshop

if (app.documents.length > 0) {

var myDocument = app.activeDocument;

var theName= myDocument.name.match(/(.*)\.[^\.]+$/)[1];

var thePath = myDocument.path;

var theLayer = myDocument.activeLayer;

// psd options;

psdOpts = new PhotoshopSaveOptions();

psdOpts.embedColorProfile = true;

psdOpts.alphaChannels = true;

psdOpts.layers = true;

psdOpts.spotColors = true;

// check if layer is smart object;

if (theLayer.kind != "LayerKind.SMARTOBJECT") {alert ("selected layer is not a smart object")}

else {

// select files;

if ($.os.search(/windows/i) != -1) {var theFiles = File.openDialog ("please select files", "*.psd;*.tif", true)}

else {var theFiles = File.openDialog ("please select files", getFiles, true)};

if (theFiles) {

// work through the array;

          for (var m = 0; m < theFiles.length; m++) {

// replace smart object;

                    theLayer = replaceContents (theFiles);

                    var theNewName = theFiles.name.match(/(.*)\.[^\.]+$/)[1];

//save jpg;

                    myDocument.saveAs((new File(thePath+"/"+theName+"_"+theNewName+".psd")),psdOpts,true);

                    }

          }

}

};

////// get psds, tifs and jpgs from files //////

function getFiles (theFile) {

     if (theFile.name.match(/\.(psd|tif)$/i)) {

          return true

          };

     };

////// replace contents //////

function replaceContents (newFile) {

// =======================================================

var idplacedLayerReplaceContents = stringIDToTypeID( "placedLayerReplaceContents" );

    var desc3 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

    desc3.putPath( idnull, new File( newFile ) );

    var idPgNm = charIDToTypeID( "PgNm" );

    desc3.putInteger( idPgNm, 1 );

executeAction( idplacedLayerReplaceContents, desc3, DialogModes.NO );

return app.activeDocument.activeLayer

};

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
Community Beginner ,
Jan 30, 2014 Jan 30, 2014

Copy link to clipboard

Copied

I can't figure out how to get this script to be able to open a folder.  When I run it , it's only letting me select PSDs on my desktop.  I'd like to be able to select files within a certain folder.  Can I change something to make it stop ghosting out folders in the opendialog command?

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
Community Expert ,
Jan 30, 2014 Jan 30, 2014

Copy link to clipboard

Copied

On a Mac replace

     if (theFile.name.match(/\.(psd|tif)$/i)) {

with

     if (theFile.name.match(/\.(psd|tif)$/i) != null || theFile.constructor.name == "Folder") {

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
Community Beginner ,
Jan 31, 2014 Jan 31, 2014

Copy link to clipboard

Copied

Awesome, it works now.  I also modified it to include JPGs.  Thank you!

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
Advocate ,
Feb 06, 2018 Feb 06, 2018

Copy link to clipboard

Copied

c.pfaffenbichler Doesnt work on OSX, it returns

'Null is not an Object'

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
Community Expert ,
Feb 06, 2018 Feb 06, 2018

Copy link to clipboard

Copied

What does not work?

Please post the Script you use and a screenshot of Photoshop (including the pertinent Panels) at time of the error.

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
Advocate ,
Feb 06, 2018 Feb 06, 2018

Copy link to clipboard

Copied

Re: Place images to a specific spot in a template

This wont work, i dont get to pick a folder nor does go to a folder. Tried both methods. I keeps showing files only.

But im not even sure this what i was looking for, it seems this script places links in open images according do a selected llist from file selection.    

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
Community Expert ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

Do you work on a Mac?

And why did you append the issue to this thread?

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
Advocate ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

I work on OSX yes, cause my reply is to your post here http://https//forums.adobe.com/message/6071753#6071753

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
Community Expert ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

Once again: Please post the Script you use.

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
Community Expert ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

Melissa, I know that you are now sorted, however this may help somebody else. Sometimes you need scripts, other times all you need to do is look at the problem from a different angle and an action will do the job. I can’t write scripts from scratch, so I usually have to rely on actions.

Rather than attempting to insert the variable named/content files into a static template – place the static template into the variable files! This will preserve the critical variable filename. You will probably need to rearrange the layer order using relative layer targeting and stacking. The variable files can be sized to include the template and the template location and placement can be recorded and used on all variable files as this does not change. Elements can be aligned and moved to specific relative or absolute positions.

Example here:

Re: Simple action to replace image from walls

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
LEGEND ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

One time visitor. She didn't check what people answered to her question since question was more important than answer?

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
Community Expert ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

Stephen Melissa post is 7 years old why post this now?  That action also flatten and has a place step and no details of the place step is display.  If it an intaractive step the user would need to select the a image place during the place size position the image  and after that may have to mask the placed layer to shape.  Then there a layer move to where? If the document was just falttened the a place done nothing can be moved below the background layer the placed layer would be on top.  Have I missed something?

action.png

JJMack

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
Community Expert ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

JJMack wrote:

Stephen Melissa post is 7 years old why post this now?

Why post now? JJ, you posted a new reply to the topic, which pushed it to the top of the list when I viewed the forum, which brought it to my attention.

Why post now? I stated that in the first sentence of my reply: “…however this may help somebody else” – which is the whole idea of these forums. I believed that I had something of value to add to the topic.

The age of the thread should make no difference, if it did Adobe’s forum software would lock the topic after a certain amount of time. Or the forum software would have a warning that the original topic was created at a certain date etc. I often update old posts with cross links or new information if I stumble across them.

This generic question is timeless and is repeated month after month, year after year. If my post helps somebody then I am happy.

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
Community Expert ,
Jul 30, 2018 Jul 30, 2018

Copy link to clipboard

Copied

Actually my post was a reply to a post made yesterday.  I was hoping to hear what they added to my script and your post may have killed any chance of that.

Also the Action download link in the thread you post in no longer valid and the Action write up is very poor  and would not work if users tried to create it from what is posted. That thread is not timeless.

JJMack

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
Community Expert ,
Jul 31, 2018 Jul 31, 2018

Copy link to clipboard

Copied

Actually my post was a reply to a post made yesterday.  I was hoping to hear what they added to my script and your post may have killed any chance of that.

Also the Action download link in the thread you post in no longer valid and the Action write up is very poor  and would not work if users tried to create it from what is posted. That thread is not timeless.

JJMack, it appears that your Adobe account has been hacked by a petulant and petty child that has not learned to share the public sandpit and mistakenly believes that it is their private toy. Perhaps it is time to change your password and regain control of your account so that the forum can return to reading your regularly eloquent posts.

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