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

Unable to auto process batch images for Mobile Case Mockup. Please help.

Guest
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

I am trying to batch process mockup images.

I made a set of actions:

Open

Edit Contents

Place

Flatten Image

Save

Update Smart Object

Close

But I am getting an error stating "edit objects not available" and if trying another way then "x object not available"

I have attached images for reference please help me. I am badly stuck. !photoshop mockup screenshot.png

TOPICS
Actions and scripting

Views

911

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 ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

Actions are not scripts they are step step step. When played and fail ina step loot at the action pallets step and the state of the current document to see what went wrong.  Posting your action would help

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
Guest
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

Hi!

I have attached a image of the actions I have created. In the actions the main issue is the place file is not replacing with the other images. It is only picking up the same image and making all the mockups with the same 1st image. !Actions.png

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 ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

Place, does not replace it places in a new smart object layer. And that place step will always place in the file recorded in the step 2.jpg.

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
Guest
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

Hello! Ok got it so how can this be solved? What should be used instead of place?

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
Engaged ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

Hi Rohit,

Try this code...

#target photoshop 

if (app.documents.length > 0) { 

    var docRef = app.activeDocument; 

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

    var docPath = docRef.path; 

    var theLayer = docRef.layers.getByName('YOUR CASE');  ; 

    // check if layer is smart object; 

    if (theLayer.kind != "LayerKind.SMARTOBJECT") { 

        alert("selected layer is not a smart object") 

    } else { 

        // select files; 

        var theFolder = Folder.selectDialog("select folder"); 

        if (theFolder) { 

            var theFiles = theFolder.getFiles(/\.(jpg|tif|eps|psd|png)$/i);             

            // work through the array; 

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

                // replace smart object; 

                theLayer = replaceContents(theFiles, theLayer); 

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

                //save jpg; 

                OutFoldJPG(docPath,theNewName+".jpg",true,12,FormatOptions.STANDARDBASELINE,Extension.LOWERCASE,"JPG");

            } 

        }; 

    } 

}; 

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 

}; 

function OutFoldJPG(docPath,dnme,cProfile,jpegQuality,MType,fCase,flagFormat){ //OutFoldTIFF(filePath,fileName,true,TIFFEncoding.TIFFLZW,Extension.LOWERCASE) 

    var outfolder = new Folder(docPath+"/"+flagFormat);       

    if (outfolder.exists == false){

        outfolder.create();

        var saveFile = new File(outfolder + "/" + dnme);           

        SaveJPG(saveFile,cProfile,jpegQuality,MType,fCase);}

    else{

        var saveFile = new File(outfolder + "/" + dnme);

        SaveJPG(saveFile,cProfile,jpegQuality,MType,fCase);}

}

function SaveJPG(saveFile, jpegQuality,cProfile,formaType,fCase){//12,true,MatteType.NONE

    //alert(saveFile+"\n"+cProfile+"\n"+jpegQuality+"\n"+fCase+"\n"+formaType);

    jpgSaveOptions = new JPEGSaveOptions();

    jpgSaveOptions.embedColorProfile=cProfile;

    jpgSaveOptions.formatOptions = formaType//FormatOptions.STANDARDBASELINE;

    jpgSaveOptions.matte =  MatteType.NONE

    jpgSaveOptions.quality = jpegQuality; //1-12

    activeDocument.saveAs(saveFile, jpgSaveOptions, true,fCase);

}

- yajiv

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
Guest
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

Hi

Thanks for script!

The script is working but only a part of the image is being fitted in the mockup after zooming. The image sizes are 960 px x 1896 px. Only a part of the image is being showed on the mockup. When replacing it is not picking up the original size of the jpg which is 960 px x 1896 px. It is making the image very big which is 4635px X 7975px. 

How can we solve this?

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 ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

Smart object layers have an associated transform,  All replacements must be the same size and resolution as the original object in the mock. They will all be transformed like the mockup object. The smart object associated transform is not replaced or altered when you replace smart object layers content.  All replacement images need to be preprocesses to have the same aspect ratio and number of pixels as the original object. That is why I do not use replace contents populating mockup.  I place in smart object layers set their transform to resize and position the images then mask it to shape.

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
Guest
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

Hi

The script is working! But the quality output is not good. The file size is 103 Kb but while doing one manually the file size is 950 Kb. The size is being reduced. The size is being reduced of the jpg while saving. Please help out with this.

Thanks in advance!

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 ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

If you want to use replace content of a smart object layer.  All replacement object must be exactly the same size and resolution as the object in the template mockup file.  A script would be needed to automate that process.  I like to be able to handle any size image. So my templates only map the size location and shape of image using alpha channels Your images will be placed in by my scripts as smart object layers then the scripts will resize the placed in images position them and mask them to shape.. 

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
Guest
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

Hi

Can you provide me a script for this?

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
Community Expert ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

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

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 ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

LATEST

Scripts are Automated Photoshop processes that are added to Photoshop like  Actions and Plug-in like Fitters like ACR and other add-ons.   Photoshop ships with some scripts  you may have used. Like Photomerge, Lens correction, .Fit Image, Merge to HDR Pro,  Image Processor, Load  Files into a stack., etc  They are Photoshop tools and like other  tools may have dependencies.  Like to use My scripts on you need create templates and use templates that follow my design rules  or you need to download templates the do..

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
Guide ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

It will fail as you have a "Flatten Image" doing this you will no longer have a smart 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