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
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:
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.
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!!
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.
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?
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?
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.
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.
Copy link to clipboard
Copied
Yes with actions you have few options when it come to file nameing. Scripting is the way to go.
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.
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
};
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?
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") {
Copy link to clipboard
Copied
Awesome, it works now. I also modified it to include JPGs. Thank you!
Copy link to clipboard
Copied
c.pfaffenbichler Doesnt work on OSX, it returns
'Null is not an Object'
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.
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.
Copy link to clipboard
Copied
Do you work on a Mac?
And why did you append the issue to this thread?
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
Copy link to clipboard
Copied
Once again: Please post the Script you use.
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:
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?
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?
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.
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.
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.