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

remove alpha channel during a batch

Community Beginner ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

Hi to everyone.

I did an action to work on a lot of files.

This action allow me to merge all layers, then create some new layers and after then i transform some of this it should save 2 different files in jpeg and tiff.

My hugest problem is that some of that files has some alpha channel saved, so, when i go to save the jpeg it ask me every single time the destination and it add me "copy" to the end of filename...

I'd like to know if there is any way to remove the alpha channel automatically before to save the jpeg...

I hope that i was understandable 😄

Thanks to all 🙂

TOPICS
Actions and scripting

Views

4.7K

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 2 Correct answers

Community Expert , Nov 23, 2019 Nov 23, 2019

Just use this script as an action statement, just before you save the file:

 

 

activeDocument.channels.removeAll();

 

You can also use this to remove paths:

 

activeDocument.pathItems.removeAll();

 

 

Votes

Translate

Translate
Community Expert , Nov 23, 2019 Nov 23, 2019

I had to sleep, however, it appears that overnight the code was posted. Here are some others:

 

// delete paths
app.activeDocument.pathItems.removeAll();
 
// delete alphas
app.activeDocument.channels.removeAll();
 
// delete layercomps
app.activeDocument.layerComps.removeAll();
 
// delete color samplers
app.activeDocument.colorSamplers.removeAll();

// delete guides
app.activeDocument.guides.removeAll();

 

Votes

Translate

Translate
Adobe
Community Expert ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

I actually have the same problem, and I haven't found a fully satisfactory solution yet.

 

You can insert a conditional step in your master action, and one of the conditions covered is that the document has alpha channels. You can then record a second action to remove it, and this will run automatically as a nested action within the master action.

 

So far so good.

 

The problem is that the action records the name of the alpha channel. If they have different names, it won't work. As long as you have only one alpha channel, and it's called "Alpha 1" or whatever the nested action specifies, it works.

 

If anyone has an actionable way to simply strip all alpha channels whatever they're called, and however many, I'd like to know.

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

Thanks for answering D_Fosse

Yes, i saw the conditional step, but my alpha channels have different name (called blue copy, red copy, etc), so is not the solution for me...

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 ,
Jul 15, 2020 Jul 15, 2020

Copy link to clipboard

Copied

LATEST

D_Fosse – I have posted script code below to remove all alpha channels, regardless of their name. You can, of course, additionally record the execution of this script into an action or assign a keyboard shortcut to the installed script.

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

I can post some script code that can be recorded into an action if that would help.

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

It would be nice but i don't know how the script code should be used 😄 sorry

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

Please do, Stephen. I have zero experience with scripts, but perhaps this is the occasion to learn...

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

I follow his suggestion, please 😄

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

I had to sleep, however, it appears that overnight the code was posted. Here are some others:

 

// delete paths
app.activeDocument.pathItems.removeAll();
 
// delete alphas
app.activeDocument.channels.removeAll();
 
// delete layercomps
app.activeDocument.layerComps.removeAll();
 
// delete color samplers
app.activeDocument.colorSamplers.removeAll();

// delete guides
app.activeDocument.guides.removeAll();

 

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
LEGEND ,
Nov 24, 2019 Nov 24, 2019

Copy link to clipboard

Copied

How that is possible, 2 answers are marked as correct ones, but only first is lifted to top?

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 ,
Nov 24, 2019 Nov 24, 2019

Copy link to clipboard

Copied

The new forums allow multiple correct answers. But, yes, only one gets moved to the top. 

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

There are scripts that can delete all alpha channels. Also scripts can save  files much better than actions. Also actions do not need to have save steps to be batched. Actions cans be batched using Automate Batch, Automate image processor pro and scripts images processor.  Have Batch or the images processor scripts save the files you want.  You may not want to delete  the alpha channels you may also want to save a PSD version of your document so you can make addition changes in the future and have your work layers and alpha channels available. You do not need to write any script code in many cases Adobe or other users provide scripts that you can use to batch your actions or scripts the you can use within your actions that help your actions do things they can not do on their own.

 

Scripts can be use in actions like any action step menu File>Script>ScriptName.   They may also be a Photoshop Plug-in  when you record an action step like menu File>Automate>Fit Image.  Adobe's Fit Image  Script is a Photoshop  Plug-in when you record the Action step the script will record the width and height setting you use in its dialog into the Action  Step. When the  Action is used when the step is played no dialog will be displayed the width and height will be passed by the action manager to the script in the action step.   Image Processor Pro is also a Plug-in script.  If you record it in an action the step will look strange for it will look empty.  The  message that gets sent to the script when the step is player is very complex. The Actions recorder  records all the data however it to complex to be displayed ins the action.   

 

There are many Photoshop Script on the web you can download.  In my crafting action package I supply a dozens or more script I wrote to be used in actions  to help you do thing like make Aspect Ratio Crops.

 

Crafting Actions Package UPDATED Aug 10, 2014 Added Conditional Action steps to Action Palette Tips.
Contains

Example
Download

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

Maybe i misunderstood what you mean, but i cannot use image processor.

I need to use the action 'cause i need to do some things before to save the files in different format.

I start with a psd file but, after some action (transform, move, change order level) i need to save the file in tiff format (without alfa channel) and then 2 different size of jpeg, so i cannot use the the image processor...

 

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

The image processor Pro can save up tp 10 files for each file processed and use 10 different actions and actions can play other actions several file formats are supported.

image.png

 

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

Just use this script as an action statement, just before you save the file:

 

 

activeDocument.channels.removeAll();

 

You can also use this to remove paths:

 

activeDocument.pathItems.removeAll();

 

 

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

Afraid you lost me there, Chuck. How do you use that as an action "statement"?

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

record menu File>Scripts>ScriptName,  menu File>Automate>ScriptName. You save that code into a script file ScriptName.jsx and store the file in Photoshop folder \Presets\Scripts\ or Your own scripts folder you have linked Pfotoshop's folder \presets\scripts\ to

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
LEGEND ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

Save above as .jsx file and in the Action record the script or Insert Menu Item (if that is in Presets / Scripts of your Photoshop folder).

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

Save the script as a plain text file, with the extension .jsx. then while recording a script, do as JJ suggested and run the script. It will become an action step.

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

Yay! It works 🙂 Thank you very much, everybody. Learned something new today 🙂

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 ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

 

Warning Adobe Broke ScriptingSupport Plug-in in CC 2015.5  that effect my run twice Scripts for actions. So I add a little garbage to get around Adobe designer bug.  If you download my scripts for actions add garbage to information.

 

Adobe official response is pure BS.  It note that Photoshop is a bad program for it strips copyright data and has an interface so you can change the data to anything you want. So now Adobe Code will not let my code reset the meta-data information back to the way  I found it, if it was empty. So now I add garbage so it will not be empty it will have garbage.  For the logic they used is garbage. For I can change the meta-data to anything. So the original data no longer exist.  Not letting the code set it back to empty is only preserving my data I'm trying to remove to reset set the data  back to how I found it.   Here is Adobe Official garbage

 

 

Sr. Product Manager, Digital Imaging

  •  
Official Response
 
Hi John, after some investigation, this new behavior is as-designed:

From the engineer: This was an intentional change to better preserve metadata during collisions from other applications:

"The new logic can lead to some cases where the user deleted information in another application and it reappears in Photoshop because it was not deleted in all instances (we have at least one source for the info, but no idea of the intention behind the change). But that is much safer than deleting added information which was intended (deleting a byline, description, or copyright is BAD)."
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 ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

This script clears everything including spot colors.
I work as a computer graphic designer,
I need to delete all alpha channels, but I don't delete the spot colors.Screen Shot 2020-07-13 at 15.16.24.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
Mentor ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

a spot color is an alpha though, right?

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 ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

True, a spot colour channel is an alpha channel, however, it is a ChannelType of SPOTCOLOR and also has an opacity value. It should be possible to use either of these as a hook to isolate spot colour channels.

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 ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

Perhaps something like this?

 

 

removeAllAlphaChannelsNotSpot();

function removeAllAlphaChannelsNotSpot() {

        var myChannel = app.activeDocument.channels;
        for (n = myChannel.length - 1; n >= 0; n--) {
            var value = myChannel[n];
            aC = myChannel[n];
            if (aC.kind == "ChannelType.MASKEDAREA") {
                aC.remove()
            }
        }
}

 

 

And the flipside to the same coin:

 

 

removeAllSpotChannelsNotAlpha();

function removeAllSpotChannelsNotAlpha() {

        var myChannel = app.activeDocument.channels;
        for (n = myChannel.length - 1; n >= 0; n--) {
            var value = myChannel[n];
            aC = myChannel[n];
            if (aC.kind == "ChannelType.SPOTCOLOR") {
                aC.remove()
            }
        }
}

 

 

P.S. I have updated my related script here:

 

https://community.adobe.com/t5/photoshop/free-script-remove-selected/m-p/11069360?page=1#M324430

 

Bulk-Remove-All-Selected-Items-14July2020.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