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

Batching Alpha Channel Manipulation On Image Sequence

Participant ,
Apr 07, 2022 Apr 07, 2022

Copy link to clipboard

Copied

Thanks to this community, I learned how to work on the alpha channel, adding, replacing and performing subtraction calculations between two masks to create a new alpha channel.  Now the hard part (at least I think it will be), batching those operations on an image sequence.  I've found PS batching to be very difficult in the past, compared to the QFX Queue (see included image).

 

In the queue seen in the image, with these few lines of script, it opens a file, loads an alpha and saves a new file.  If it said FileAlphaSubtract instead of FileAlphaLoad, an 8bit mask image would be boolean subtracted from the existing image.  The #### in the script replaces the numerical image sequence with the Start, Inc, Times values.  Running the script is blazingly fast.  I'm always marveled at how quickly it must be doing these operations AND writting a file to disk.

 

Now to Photoshop.  As an animator compositing my renderings in Premier, I often do one of these two batch operations to an image sequence for use in my composite; add an alpha sequence to an image sequence or subtract an alpha sequence from an image sequence.  Say I have Test0000.tif to Test0300.tif.  I also have TMask0000.tif to TMask0300.tif.  So the PS batching needs to automate what just learnd to do manually.  Open an image, open the mask image, copy the mask image, paste it into the alpha channel of the main image, save to a new file, close the open images, repeat for the entire sequence.

 

Even more difficult, Open an image that already has alpha, open a mask image, added an additional channel in the first image, copy paste the mask image into the additional channel, run Calculations to subtract Aplha 2 from Alpha 1 creating a new channel, delete the Alpha 1 & 2 channels, then saving the file to a new image, and repeat for the entire sequence.

 

Just a few lines of script in QFX.  I have a feeling this is not so simple in PS.

Thanks and best regards.

 

TOPICS
Windows

Views

1.2K

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

correct answers 3 Correct answers

Community Expert , Apr 10, 2022 Apr 10, 2022

Why would you want to waste resources with copying and pasting instead of using Calculations straight-up? 

Screenshot 2022-04-10 at 14.18.39.pngScreenshot 2022-04-10 at 14.18.47.png

Votes

Translate

Translate
Community Expert , Apr 11, 2022 Apr 11, 2022

@buck-w 

 

You can try the following script.

 

Images are required to be in three separate folders and are selected by a prompt. A fourth save/output folder can be selected by a prompt.

 

Example of the folder structure:

list.png

 

Javascript –

 

/* 
Batch Alpha Channel Image Sequence.jsx
Version 1.0 - Stephen Marsh, April 11 2022
https://community.adobe.com/t5/photoshop-ecosystem-discussions/batching-alpha-channel-manipulation-on-image-sequence/td-p/12864593
*/

#target photoshop

if (!app.documents.le
...

Votes

Translate

Translate
Community Expert , Apr 13, 2022 Apr 13, 2022

This should work if the Mask-file’s name is the same as the RGB-file’s with »-Mask_« before the numbers.

 

Edited the Script 2022-04-14: 

 

// insert one channel from file with »-mask_« in otherwise identical name;
// 2022, use it at your own risk;
var theFolder = Folder("/Archiv HD/Pfaffi HD1/pfaffi_privat/photoshop/test/untitled folder 6");
if (theFolder.exists == false) {var theFolder = Folder.selectDialog ("select folder")};
if (theFolder) {
var theFiles = theFolder.getFiles(/\.(tif|psd)$/i)
...

Votes

Translate

Translate
Adobe
Participant ,
Apr 11, 2022 Apr 11, 2022

Copy link to clipboard

Copied

Just ran it.  Worked flawlessly.  Awesome!

Thanks-o-bunch.

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