Copy link to clipboard
Copied
elvisk 99891586 The thread we were use dealing with your mockup seems to be busted.
The thread I started yesterday was slammed to the old thread and now has vanished from the Photoshop form.
Lets try again:
I had look at your mockup templates they basically had two problems. So I create three that should work and posted a link them. However, the post to them did not get posted in that thread. The thread is busted??? And the thread I started yesterday has vanished.
Your Phones Mockup Templates have two different aspect ratios and your smart objects design has a third aspect ratio.
The Smart Layers that shows the content of the smart object design on your Phone Cases have linked Layer Mask. They should not be linked. You want to be able to scale the smart object for the size and position of the case in your mockup. You want to mask the scaled object for the Shape of the case and the cut-outs in the case.
Your S7 phone has a 0.493 aspect ratio. Your S8 and S8+ case have a 0.467 aspect ratio which is close to the S7 aspect ratio. Your Smart Object design has a 0.588 aspect ration. A wide aspect ration like that content will not scale well for your cases aspect ration its content would need to be cropped.
When you use my script with the wrong aspect ration replacement content and use its edit option to fit the content to the smarts object my script will scale the replacement to fill the smarts object area either the height or width will be the correct size. The smart object canvas size will clip off any excess image. The replacement will be like a centred aspect ration image crop. The Mockup template should have an aspect ratio that is good for the case with a proper aspect ration for the case. Only replacement images with the same aspect of the Smart Object will be perfectly fitted to you cases. Other aspect ratio designs will be like centred aspect ration crops.
So I creates a smart object that is larger than the S7 case that has the same Aspect ratios as your S7 case. I scaled the smart object layer for the S7 Case size and position it in the mockup template. I then added your layer mask not linked to the smart object content. The mask is for the case which is in many layers that need the be in same alignment. Changing the layer's transform to tweak the design content would mess up the layers alignment and size if the layer mask was linked. I use the same smart objevt in the three mockups. I squeezed in the design a little in the S8 abd S8+ template girls will be a little thinner. Not a bad thing...
I then through some random portraits replacement images at the mockups in general the cases mockup look good however some of the wider portraits virtual centred corps composition is not very acceptable. Design for your cases need to have a narrow aspect ratio.
Copy link to clipboard
Copied
Sorry, I am new to scripting and having issues with the accepted solution for the OP.
When I run the script, it keeps bringing up a warning saying the smart layer is not on top (I am assuming in the layer panel)?
However, I cannot have it at the top as there are effects layers that I need to keep.
I ended up finding this on Github;
#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;
// JPG Options;
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = 8;
// Check if layer is SmartObject;
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;*.jpg", true)
} else {
var theFiles = File.openDialog("please select files", getFiles, true)
};
if (theFiles) {
for (var m = 0; m < theFiles.length; m++) {
// Replace SmartObject
theLayer = replaceContents(theFiles[m], theLayer);
var theNewName = theFiles[m].name.match(/(.*)\.[^\.]+$/)[1];
// Save JPG
myDocument.saveAs((new File(thePath + "/" + theName + "_" + theNewName + ".jpg")), jpgSaveOptions, true,Extension.LOWERCASE);
}
}
}
};
// Get PSDs, TIFs and JPGs from files
function getFiles(theFile) {
if (theFile.name.match(/\.(psd|tif|jpg)$/i) != null || theFile.constructor.name == "Folder") {
return true
};
};
// Replace SmartObject Contents
function replaceContents(newFile, theSO) {
app.activeDocument.activeLayer = theSO;
// =======================================================
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
};
It seems to do the job but I have two aspects that I would like to improve for it to really work as I would like;
1- How to make it so that it automatically selects the smart layer? Currently, the smart layer has to be pre-selected.
2- How can I automate it to place the image in the smart layer across all open files? Right now it only does one file so I have to keep switching and running the script. I then created an action for this so it goes to the next open file after it is done but I still have to select the file to place in the smart layer manually through a pop-up.
Thank you!
Copy link to clipboard
Copied
But you can have the smart object that need to be replaces on the top of the layer stack. That should not be a problem. The smart object layer on the top of the layer stack do not have to be visible in the templates composition. Smart Object Layer that share the objects in the top level smart objects can use(display) the object in the templates composition. For example here is a Car Seat mockup template. It has two top level smart object layers. The Driver Seat and the passenger seat covers. They are not visible. In the Mockup Group there are four smart object layers that share the seat objects at the top of the stack two share the driver seat two the passenger seat. They display the seat backs and the and the seat bottoms in the composition. The issue is you did not know how to make your mock up compatible with the script. You lack some knowledge about Photoshop. We all share this issue no one knows everything that can be done with Photoshop. We only learn what we need to use.... over time as we use Photoshop.
Copy link to clipboard
Copied
So you asked the following short answer is the script does it all, but you need to set thing up correctly.
1- How to make it so that it automatically selects the smart layer? Currently, the smart layer has to be pre-selected.
2- How can I automate it to place the image in the smart layer across all open files? Right now it only does one file so I have to keep switching and running the script. I then created an action for this so it goes to the next open file after it is done but I still have to select the file to place in the smart layer manually through a pop-up.
The script well replace All the Smart layers contents using Layer>Smart Object>Replace Content or Edit Content. The default operation is to use Replace Content which require you to have the correct size objects in the replacement collection sub folders. The Script has a Edit option if checked the script will edit the replacement into the object. There are additional edition the select how the replacement should be fitted into The object.
Copy link to clipboard
Copied
Hi @JJMack,
Sorry for the delay, I was traveling and could not get back to you.
With some trial and error here, I managed to get my files to work with the script as you mentioned and now I am getting the results I was looking for!!
Thank you so much for your help as well as your scripts, it is all very much appreciated! 🙂
Copy link to clipboard
Copied
Hi @JJMack,
I just switched to a Windows PC from Mac and did all steps as supposed to but the script seems to not run on Windows...
I get to the stage of selecting folders for Mockups Templates, Objects and Output, when I click create, nothing runs, it just closes the folder selection window. All steps and folders are exactly as they were on my Mac so I'm not sure where I am going wrong?
Thank you
Copy link to clipboard
Copied
You need to complete the top of the dialog template, replacement, ouput, folders then click the create button in the bottom of the dialog. I use Windows the Script should also work on a Mac. Welcom to Windows.
Did my script give you any massage. It should have stated how lonng ran and the number of mockup it crated or it coul mof find something.
Copy link to clipboard
Copied
Thanks, yes, Windows is much more robust for multiple tasks I just couldn't easily get done on Mac 🙂
When you say Complete the top of the dialog template, do you mean to assign the correct folder paths? If so, this is already done. Each input has the correct folder path and when I click Create, nothing runs/happens...
Maybe it could be something with PS so I may try a reinstall.
Copy link to clipboard
Copied
If my script dialog is filed with wrong data I would think it would display error messages for you.
Copy link to clipboard
Copied
No error(s) shows up..the window just closes once I click Create then nothing happens
Copy link to clipboard
Copied
From reading the settings in that dialog you posted
It look like you may not have installed my toolkit correctly. I forgot to add the mockup scripts into the readme file. I did not think I needed too. I'll do that soon. Still If the script could display its dialog and you could select folders. I think the script should put out some message if it could not find a template or smart object layer or replacement folders or files. any error it may catch catch should have generated some message. Did you see any document tab or image window open?. After checking settings folders and files exist the first thing the script dos is open a template. Can you post your mockup template psd file.
If the batch job was large nothing may happen for a long time if Replace content is being used It will look like Photoshop is hung till all the mockups have been save. Did you have to terminate Photoshop did it look hung?
Place the .jxs files in Photoshop Presets\Scripts Folder
Drop the .atn files and .asl files onto Photoshop to load the actions and Layer styles
Unzip CollageTemplates.zip into "C:\Program Files\Adobe\Adobe Photoshop Templates" or any folder you want to keep your collage templates in.
You will see the scripts listed in Photoshop menu File>Scripts>script name
Files in zip
1.) ReadMe.txt
2.) JJmack's Photo Collage Toolkit Scripts.atn
3.) SnowGlobe.atn
4.) Photo Collage Styles.asl
5.) Photo Collage Text Styles.asl
6.) CollageTemplates.zip
7.) HelpPhotoCollageToolkit.jsx
8.) LayerToAlphaChan.jsx
9.) CollageTemplateBuilder.jsx
10.) TestCollageTemplate.jsx
11.) InteractivePopulateCollage.jsx
12.) PopulateCollageTemplate.jsx
13.) BatchOneImageCollage.jsx
14.) BatchMultiImageCollage.jsx
15.) ReplaceCollageImage.jsx
16.) ChangeTextSize.jsx
17.) PasteImageRoll.jsx
18.) BatchPicturePackage.jsx
19.) BatchPicturePackageNoRotate.jsx
20.) PopulatePicturePackage.jsx
21.) PCTpreferences.jsx
add the four mockup script to the script list
22.) BatchMockupTemplates.jsx
23.) BatchUpdateSmartObject.jsx
24.) BatchReplaceOneObject.jsx
25.) PopulateAlbumPageMockups.jsx
Copy link to clipboard
Copied
I have been trying nearly all day to get this to work but for some reason still not. The other scripts seem to execute without any problems, it is only the Batch Mockup Templates that does not.
The mockup files are the same as they were on my Mac and when I try the exact same process there, it runs without any issues. They also work with other scripts as mentioned. Here is the link to 3 of the mockup files as well as a screen recording of the process; https://drive.google.com/drive/folders/1KJfLNi8uouXZRDWOtkTh-rYwYPXBqHTJ?usp=sharing
I even updated to the latest version of PS but still doesn't seem to work out. I am not sure why the other batch scripts run but just not this one.
Thanks
Copy link to clipboard
Copied
I miss the link to your templates. basically the templates have two problems, The Smart object Aspect ration is not appropriate for your Phone cases. You have three phone cases with two different aspect ration. The second problem you did not transform the smart object layer for the cases you just masked it and the mask is link it should not be so you can transforms the smart object layer for the case and mask it for the case cutouts and shape.
The aspect ration you have are .493 and .467 they aer not that far apart. So I created the Object with an .493 aspect ratio for the S7. So when the object is transform fro the ,467 cases the image will be distorted a little inward the Girls will look a little thinner.
Try these PhoneTemplates.zip
Copy link to clipboard
Copied
Try these PhoneTemplates.zip
Copy link to clipboard
Copied
Ok, I managed to get something working because I have received errors after clicking Create.
Copy link to clipboard
Copied
To add, the name of the output file (apart from the first two characters "._") is not from the current file in the Replacement folder. It is actually the name of a file that had worked previously on my Mac (I just transferred the folders to my Windows PC).
To try again, I deleted all scripts, downloaded them again, used fresh PSD files, and new dialog folders but the errors come up and it somehow saves output files with that old file name...
Copy link to clipboard
Copied
Thanks for your replies.
It is strange because I just tried the same exact files on my Mac and the script worked perfectly. I then downloaded the original PSD files, set them up according to the 4 rules, tried running it on my Windows PC, and still came up with the errors...
Here is the link to the mockup template; https://drive.google.com/drive/folders/1KJfLNi8uouXZRDWOtkTh-rYwYPXBqHTJ?usp=sharing
Many thanks
Copy link to clipboard
Copied
This message
Indicated you are using the script edit option to edit wrong size replacements into the existing smart Object. Unfortunately your Mockup template is not compatible with this option your ArtLayer Case Design object is not a Photoshop object it is an ACR or AI object the script can not edit ACR and AI object. It in the documentation.
You either need to have the correct size replacement and have the Script use it default operation mode Replace Content to populate the Template or updated your mockup template. Re-create the Mockup template's smart object layer ArtLayer Case Design using a Photoshop object. All smart object layer that share that ArtLayer Case Design object also need to be replaced using duplicates of the re-created ArtLayer Case Design smart object layer and then positioned in the layer stack for how it was used transform and distorted for the mockup composite. Simple Mock Rule #2
Four Rules
Upload your mockup template and post a link to it.
Copy link to clipboard
Copied
The reason the the script can not edit Photoshop object is quit simple. If the script were to open a none Photoshop object the Work File created by Photoshop to work on the object would open in ACR or Illustrator the script can not automate ACR or Illustrator operation to change the object content.
Copy link to clipboard
Copied
Thanks for your replies.
I had a look and tried to use the original source files and made sure they are within the 4 rules but still got the errors.
When I ran the script with same files on my Mac, it ran without any errors and I got the results correctly in the Output folder.
Did you manage to try with the files in the Google Drive link above? If you could please have a look to see, maybe it runs fine for you then I can consider what else to try.
Many thanks
Copy link to clipboard
Copied
Thanks for your replies.
It is strange because I just tried the same exact files on my Mac and the script worked perfectly. I then downloaded the original PSD files, set them up according to the 4 rules, tried running it on my Windows PC, and still came up with the errors...
Could you please have a look at the PSD files in the Google Drive link I posted earlier? Maybe there is something you can point out in the file because on Mac it runs the script fine...
Many thanks
Copy link to clipboard
Copied
Try thess PhoneTemplates.zip
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I tried to post some updated template for your Phone. The problem you had were your smart object has the poor aspect ration for you Phones. Then the Smart Object layer in the mockup for the actual case had a linked layer mask it should not have been linked. The Smart Object layer content should have been Transform for the case Aspect ratio and positioned over the case and then mask for the case shape and cutouts, the S7 has a wider Aspect ratio. So I created the object Aspect ratio for the s7 so image will be squashed in a bit on the other two phone not badly girls will be a little thinner.
Copy link to clipboard
Copied
Test