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

Any script can make multiple mockup images ?

Participant ,
Jun 15, 2023 Jun 15, 2023

I want to make 3-4 mock-up/show cases images for each art photos, now I am process manually and very time consuming, any script can make these processing automatically

 

Like this sample effect (manually made, how to auto ?)

mock_up.jpg

 

TOPICS
Actions and scripting , Windows
2.3K
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 16, 2023 Jun 16, 2023

There have been several of threads on this issue. 

Please do a Forum search (»template replace script« for example) and if you have further questions provide the files or at the very least post meaningful screenshots that illustrate the template file’s Layer structure – did you set up the placed image as a Smart Object? 

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
Participant ,
Jun 16, 2023 Jun 16, 2023

My mock up file is like this

1.png

1. I open this file

2. The middle layer is linked to another PSD file, double click will open this file

3. Place the art image on this file and adjust size to fit (I did not set up the image as smart object)

4. Save and close and back to the mock up file

5. Save as jpeg

 

I need open 3-4 mock up files to repeat step 2-5, then I have 3-4 mock up images

 

Am I doing in stupid way ?

Any script can do it in batch?

Or any tutorial I can make my own script ?

 

Thanks

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 16, 2023 Jun 16, 2023
quote

Am I doing in stupid way ?

Do all the replacement files have the same dimensions as the originally placed image? 

 

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
Participant ,
Jun 16, 2023 Jun 16, 2023

That is my most headache problem, for example : I have 5 files, there dimention are : 

2419*4730, 1112*867, 735*914, 2767*2012, 3901*3037 (Pixels)

 

Then I need put these 5 images into my mock-up set (4 mock-up files), finally, I got total 20 mocked-up files in jpeg format.

 

So, each time I place image into the middle layer, I need to adjust size, some time need to crop the image.

 

Such complicated processing, any script can do it ?

 

Thank you

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 17, 2023 Jun 17, 2023
quote

That is my most headache problem, for example : I have 5 files, there dimention are : 

2419*4730, 1112*867, 735*914, 2767*2012, 3901*3037 (Pixels)

 

Then I need put these 5 images into my mock-up set (4 mock-up files), finally, I got total 20 mocked-up files in jpeg format.

 

So, each time I place image into the middle layer, I need to adjust size, some time need to crop the image.

That seems like bad planning. 

But a Smart-Object-in-Smart-Object-approach should be more or less able to handle the situation.  

 

And »some time need to crop« seems like a pointless statement when is comes to Scripting. 

At what time exactly do you need to crop? Which exact parameters determine if, when and what has to be cropped? 

 

Do the current Smart Objects in all 4 mock-ups have the exact same dimensions at least? 

 

Please provide one of the template files and the set of replacement images (feel free to blacken out any sensitive elements). 

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
Participant ,
Jun 17, 2023 Jun 17, 2023

Thank you very much, I uplaoded 3 set (image+mockup+finished image), you can see what the problem is :

 

1. My images are not same aspect ratio

2. The BatchMockupTemplates.jsx by JJMack limted the smart object layer need to be 1st layer

 

See if you can give me some advises

 

 

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
Participant ,
Jun 16, 2023 Jun 16, 2023

I found a similiar, but I don't know how it can handle differnt aspect ratio, take a look and appreciated for any advises

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 16, 2023 Jun 16, 2023
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
Participant ,
Jun 16, 2023 Jun 16, 2023

I downloaded, but NO MOCK-UP template file in zip file, so I can not test

 

If you have a mock-up file work for this script (BatchMockupTemplates.jsx), please upload and let me test, thank you very much

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 16, 2023 Jun 16, 2023

There are links to very specific simple instructions that the script requires for use.

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
Participant ,
Jun 16, 2023 Jun 16, 2023

I tried my template files, you can see the script do not know how to resize replace file (art image), here is the result

2.pngFranziska Schlopsnies_Schlopsnies_Aber_Meta_1 01 (小).jpg

 

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 16, 2023 Jun 16, 2023
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 16, 2023 Jun 16, 2023

There are many mock-up smart object replacement scripts on the forum if you search. It is hard for them to be generic or general purpose as they are usually created for a specific project.

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 19, 2023 Jun 19, 2023
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 20, 2023 Jun 20, 2023

The Script from that thread could be modified – either to offer an additional file-selection dialog to select the templates or by hard-coding the templates’ paths into the Script. 

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
Participant ,
Jun 20, 2023 Jun 20, 2023

Thank you very much, it works like a charm, I just need to group the jpg in same aspect ratio, then will auto done for me.

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 20, 2023 Jun 20, 2023

Actually that Script should fit the images into the Smart Object anyway. 

Or did you want to clip them so they fill the SO but lose the parts on the side (or top/bottom)? 

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
Participant ,
Jun 20, 2023 Jun 20, 2023

I will find different aspect ratio mock-up files and group them, then 3:2 images will use 3:2 mock-up PSD, 5:7 will use 5:7 mock-up........

 

Appreciated if you can modify a bit make it like JJMack's BatchMockupTemplates.jsx point to 2 folder - images folder and mock-up folder, then finish 3-4 set mockup images automatically that will be a great help.

 

Sorry for too greedy to ask this, thank you.

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 22, 2023 Jun 22, 2023
// select template files, select images to be placed;
// place selected images in active smart object and save jpgs;
// 2023, use it at your own risk;
// Select Files;
if ($.os.search(/windows/i) != -1) {
    var theTemplates = File.openDialog("please select template files", "*.psd;*.tif;*.jpg", true)
} else {
    var theTemplates = File.openDialog("please select template files", getFiles, true)
};
if (theTemplates) {
if ($.os.search(/windows/i) != -1) {
    var theFiles = File.openDialog("please select image files", "*.psd;*.tif;*.jpg", true)
} else {
    var theFiles = File.openDialog("please select image files", getFiles, true)
};
if (theFiles) {
for (var x = 0; x < theTemplates.length; x++) {
    var myDocument = app.open(File(theTemplates[x]));
    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 = 11;   
// Check if layer is SmartObject;
    if (theLayer.kind != "LayerKind.SMARTOBJECT") {
        alert("selected layer is not a smart object")
    } else {
// Select Files;
        if (theFiles) {
            for (var m = 0; m < theFiles.length; m++) {
                var theState = myDocument.activeHistoryState;
                var theSO = openSmartObject ();
                placeScaleRotateFile (theFiles[m], 0, 0, 100, 100, 0);
                scaleToCanvasSize ();
                theSO.close(SaveOptions.SAVECHANGES);
                var theNewName = theFiles[m].name.match(/(.*)\.[^\.]+$/)[1];
                // Save JPG
                myDocument.saveAs((new File(thePath + "/" + theName + "_" + theNewName + ".jpg")), jpgSaveOptions, true,Extension.LOWERCASE);
                myDocument.activeHistoryState = theState;
            }
        }
    }
}
}
};
// 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
};
////// open smart object //////
function openSmartObject () {
    var desc2 = new ActionDescriptor();
    executeAction( stringIDToTypeID( "placedLayerEditContents" ), desc2, DialogModes.NO );
    return activeDocument;
    };
////// place //////
function placeScaleRotateFile (file, xOffset, yOffset, theXScale, theYScale, theAngle) {
    // =======================================================
        var desc5 = new ActionDescriptor();
        desc5.putPath( charIDToTypeID( "null" ), new File( file ) );
        desc5.putEnumerated( charIDToTypeID( "FTcs" ), idQCSt = charIDToTypeID( "QCSt" ), charIDToTypeID( "Qcsa" ) );
        var idOfst = charIDToTypeID( "Ofst" );
            var desc6 = new ActionDescriptor();
            var idPxl = charIDToTypeID( "#Pxl" );
            desc6.putUnitDouble( charIDToTypeID( "Hrzn" ), idPxl, xOffset );
            desc6.putUnitDouble( charIDToTypeID( "Vrtc" ), idPxl, yOffset );
        var idOfst = charIDToTypeID( "Ofst" );
        desc5.putObject( idOfst, idOfst, desc6 );
        var idPrc = charIDToTypeID( "#Prc" );
        desc5.putUnitDouble( charIDToTypeID( "Wdth" ), idPrc, theYScale );
        desc5.putUnitDouble( charIDToTypeID( "Hght" ), idPrc, theXScale );
        desc5.putUnitDouble( charIDToTypeID( "Angl" ), charIDToTypeID( "#Ang" ),theAngle );	
        desc5.putBoolean( charIDToTypeID( "Lnkd" ), false );
    executeAction( charIDToTypeID( "Plc " ), desc5, DialogModes.NO );
    return app.activeDocument.activeLayer;
    };
////// scale active layer to canvas dimensions //////
function scaleToCanvasSize () {
// scale smart object:
    var originalRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    var layerDesc = executeActionGet(ref);
    var theBounds = layerDesc.getObjectValue(stringIDToTypeID('bounds'));
    var theX = theBounds.getInteger(stringIDToTypeID('left'));
    var theY = theBounds.getInteger(stringIDToTypeID('top'));
    var theX2 = theBounds.getInteger(stringIDToTypeID('right'));
    var theY2 = theBounds.getInteger(stringIDToTypeID('bottom'));
// determine the scale;
    var theSOProp = activeDocument.width/activeDocument.height;
    var theNewProp = (theX2 - theX)/(theY2 - theY);
    if (theNewProp >= theSOProp) {var theScale = activeDocument.width / (theX2 - theX) * 100}
    else {var theScale = activeDocument.height / (theY2 - theY) * 100};
// transform;
    var desc23 = new ActionDescriptor();
    var ref2 = new ActionReference();
    ref2.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
    desc23.putReference( charIDToTypeID( "null" ), ref2 );
    var idOfst = charIDToTypeID( "Ofst" );
      var desc24 = new ActionDescriptor();
      var idPxl = charIDToTypeID( "#Pxl" );
      desc24.putUnitDouble( charIDToTypeID( "Hrzn" ), idPxl, activeDocument.width/2 - (theX+(theX2-theX)/2) );
      desc24.putUnitDouble( charIDToTypeID( "Vrtc" ), idPxl, activeDocument.height/2 - (theY+(theY2-theY)/2) );
    desc23.putObject( idOfst, idOfst, desc24 );
    var idPrc = charIDToTypeID( "#Prc" );
    desc23.putUnitDouble( charIDToTypeID( "Wdth" ), idPrc, theScale );
    desc23.putUnitDouble( charIDToTypeID( "Hght" ), idPrc, theScale );
    desc23.putEnumerated( charIDToTypeID( "Intr" ), charIDToTypeID( "Intp" ), stringIDToTypeID( "bicubicAutomatic" ) );
    desc23.putEnumerated( stringIDToTypeID( "freeTransformCenterState" ), stringIDToTypeID( "quadCenterState" ), stringIDToTypeID( "QCSAverage" ) );
//            desc23.putBoolean( charIDToTypeID( "Cpy " ), true );
    executeAction( charIDToTypeID( "Trnf" ), desc23, DialogModes.NO );
    app.preferences.rulerUnits = originalRulerUnits;
    };
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
Participant ,
Jun 22, 2023 Jun 22, 2023
LATEST

Thank you very much; it works like a charm. I don’t know how to express my thanks; you help me a lot; you are a kind expert.

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