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

AUTOMATE, BATCH, ACTION, mask import !!!

Community Beginner ,
Sep 27, 2020 Sep 27, 2020

Copy link to clipboard

Copied

Hello, 

I need to process sequence of images using Batch. 

There is such command File -> Place Embedded, in one step of Action. (import of a mask - PNG image with alpha chennel)

I need to achieve that for each subsequent image, a mask with the next index number is imported. 

That is, for Image1 - Mask1, for Image2 - Mask2, for Image3 - Mask3 etc. 

 

sor far, for each subsequent image, the Action imports the same mask 

(the image that was specified while action recording)

 

That is, for Image1 - Mask1, for Image2 - Mask1, for Image3 - Mask1 etc. 

 

Please tell me te sollution! 

Thank you in advance!

 

 

 

TOPICS
Actions and scripting

Views

1.4K

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 Beginner ,
Sep 27, 2020 Sep 27, 2020

Copy link to clipboard

Copied

images are located in folder A

masks   are located in folder B

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 27, 2020 Sep 27, 2020

Copy link to clipboard

Copied

What do you mean by masks are in folder b.  What are your masks files? How do Photoshop document the images and mask are imported get into Photoshop. How many  images and mask get are imported into a document.  How are they arranged or align in you documents. Photoshop Batch opens one image at time and plays the batch action on the opened document before moving on to the next sequential image.  Actions can not use any logic the find what the current open document name is to match a image to a mask. Actions steps are fixed  they can not use logic to set an import mask file that need to imported.   What you want to can not be automated via Photoshop action. You may be able to do automated what you want to do using Photoshop scripting.  However, what you posted can not be automated for you description is that of an incomplete process. I have no idea of what you actually want to do.  You noted Batch, Image, automating image  masking via mask file using Actions.  Even if you supply the missing details  I do not believe your process could be automated via a Photoshop batch action.

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 Beginner ,
Sep 28, 2020 Sep 28, 2020

Copy link to clipboard

Copied

Hello,

thank you for your respond!

I already know that I need a script.

 

I need to process sequence of images in such way:

Folder 1 contains

sequence:

 

image1

image2

image100

 

Folder 2 contains

sequence:

 

mask1

mask2

mask100

 

masks are PNG+alpha

 

For every subsequent image, Batch must run Action, and import PNG mask with next subsequent index.

Then complete Action, save processed image in folder 3, and close document.

Then open next image, and repeat the process.

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 28, 2020 Sep 28, 2020

Copy link to clipboard

Copied

I think posting meaningful screenshots of the Folders and some sample files with the intended results would have been helpful. 

So far I am not sure, for example, if the masks are grayscale or RGB. 

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 ,
Sep 28, 2020 Sep 28, 2020

Copy link to clipboard

Copied

So far I am not sure, for example, if the masks are grayscale or RGB

Action users masks to determine countour of central object, it uses only Alpha channel

 

There is needed script for described task. 

script which can add +1 to index of a mask, in every step when action imports next file. 

 

 

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 28, 2020 Sep 28, 2020

Copy link to clipboard

Copied

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 28, 2020 Sep 28, 2020

Copy link to clipboard

Copied

I found another old Script you might be able change to meet your needs. 

// combine images from  two folders;
// 2016, use it at your own risk;
#target photoshop
// select folders;
var theFolder1 = Folder.selectDialog ("select folder");
if (theFolder1) {
var theFolder2 = Folder.selectDialog ("select other folder");
if (theFolder2 && String(theFolder1) != String(theFolder2)) {
// get files;
var theFiles1 = theFolder1.getFiles(/\.(jpg|tif|eps|psd)$/i);
var theFiles2 = theFolder2.getFiles(/\.(jpg|tif|eps|psd)$/i);
// if more than one image is in the folder and equal number in both;
if (theFiles1.length > 0 && theFiles2.length == theFiles1.length) {
// tif options;
tifOpts = new TiffSaveOptions();
tifOpts.embedColorProfile = true;
tifOpts.imageCompression = TIFFEncoding.TIFFLZW;
tifOpts.alphaChannels = false;
tifOpts.byteOrder = ByteOrder.MACOS;
tifOpts.layers = true;
// do the operation;
for (var m = 0; m < theFiles1.length; m++) {
var theFile = theFiles1[m];
var theOtherFile = theFiles2[m];
// create file;
var myDocument = app.open(File(theFile));
var docName = myDocument.name;
var basename = docName.match(/(.*)\.[^\.]+$/)[1];
var docPath = myDocument.path;
// place the corresponding file;
placeScaleFile (theOtherFile, 0, 0, 100);
//save tif as a copy:
myDocument.saveAs((new File(Folder(theFolder1).parent+"/"+basename+"_combined"+".tif")),tifOpts,true);
myDocument.close(SaveOptions.DONOTSAVECHANGES)
}
};
alert ("done")
}
};
////// get from subfolders //////
function retrieveJPGs (theFolder, theFiles) {
	if (!theFiles) {var theFiles = []};
	var theContent = theFolder.getFiles();
	for (var n = 0; n < theContent.length; n++) {
		var theObject = theContent[n];
		if (theObject.constructor.name == "Folder") {
			theFiles = retrieveJPGs(theObject, theFiles)
			};
		if (theObject.name.slice(-4) == ".jpg" || theObject.name.slice(-4) == ".JPG") {
			theFiles = theFiles.concat(theObject)
			}
		};
	return theFiles
	};
////// place //////
function placeScaleFile (file, xOffset, yOffset, theScale) {
// =======================================================
var idPlc = charIDToTypeID( "Plc " );
    var desc5 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
    desc5.putPath( idnull, new File( file ) );
    var idFTcs = charIDToTypeID( "FTcs" );
    var idQCSt = charIDToTypeID( "QCSt" );
    var idQcsa = charIDToTypeID( "Qcsa" );
    desc5.putEnumerated( idFTcs, idQCSt, idQcsa );
    var idOfst = charIDToTypeID( "Ofst" );
        var desc6 = new ActionDescriptor();
        var idHrzn = charIDToTypeID( "Hrzn" );
        var idPxl = charIDToTypeID( "#Pxl" );
        desc6.putUnitDouble( idHrzn, idPxl, xOffset );
        var idVrtc = charIDToTypeID( "Vrtc" );
        var idPxl = charIDToTypeID( "#Pxl" );
        desc6.putUnitDouble( idVrtc, idPxl, yOffset );
    var idOfst = charIDToTypeID( "Ofst" );
    desc5.putObject( idOfst, idOfst, desc6 );
    var idWdth = charIDToTypeID( "Wdth" );
    var idPrc = charIDToTypeID( "#Prc" );
    desc5.putUnitDouble( idWdth, idPrc, theScale );
    var idHght = charIDToTypeID( "Hght" );
    var idPrc = charIDToTypeID( "#Prc" );
    desc5.putUnitDouble( idHght, idPrc, theScale );
    var idLnkd = charIDToTypeID( "Lnkd" );
    desc5.putBoolean( idLnkd, false );
executeAction( idPlc, desc5, 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 Expert ,
Sep 28, 2020 Sep 28, 2020

Copy link to clipboard

Copied

In case you can not figure out how to write or modify script for your project keep in mind that you have solution using actions but you must do some manual work: to select which mask to be imported. This can be achieved by enabling modal control for step Place (arrow pointing to modal control on my screenshot below) or use Insert Menu Item to record Select Place menu item.

place step.jpg

 

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 ,
Oct 01, 2020 Oct 01, 2020

Copy link to clipboard

Copied

Thanks to all for your answers, I solved this question in another way

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 ,
Oct 01, 2020 Oct 01, 2020

Copy link to clipboard

Copied

And do you wanna tell us, how do you solved it?

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 ,
Oct 01, 2020 Oct 01, 2020

Copy link to clipboard

Copied

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, 2020 Oct 01, 2020

Copy link to clipboard

Copied

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, 2020 Oct 01, 2020

Copy link to clipboard

Copied

LATEST

I think this is duplicated thread. You can not fully automate process using script like Image Processor and action, the only solution to use Photoshop actions for your task is to manually select mask to import. This can be achieved by turning modal dialogue for that step which will open Place dialogue and wait for you to navigate to image.

 

I can not see your file to gie you advice using data driven graphics. If you want to import image on separate layer then you can use variables and data driven graphics. If you want to apply imported image as layer mask then use data driven graphics to import image on separate layer then run batch to use that layer for layer mask. This is the only way to fully automate task if you have huge or enormous amount of files and you ultimatelly want to fully automate process. Otherwise you may be able to use script but not actions, do you understand why? There is no script on market or available to download which will allow you to process files in that manner and to run action. Scripts usually allow you to select folder to process but not and folder to import/place files during batch.

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