RetouchPRO

Go Back   RetouchPRO > Technique > Photo Retouching
Register Blogs FAQ Site Nav Search Today's Posts Mark Forums Read


Photo Retouching "Improving" photos, post-production, correction, etc.

A way to delete all alpha channels at once?

Reply
 
Thread Tools
  #11  
Old 02-25-2012, 02:07 AM
mantra's Avatar
mantra mantra is offline
Senior Member
 
Join Date: Apr 2010
Location: Rome
Posts: 285
Thumbs up Re: A way to delete all alpha channels at once?

Quote:
Originally Posted by Der_W View Post
With actions alone its not possible, but you could use a script like this:



You can record the script by using "File"-"Scripts"-"Browse" and choosing the Channels.jsx file.
Quote:
Originally Posted by Der_W View Post
Of course there is :-)



PS: You can also put those two together to delete paths and channels at the same time, if you want to, just add the last line of each script to the other one and save as *.jsx.
Hi MASTER
i was looking for them
googled and there you are!

may i ask a question ?

i have another situation , working on an image ,running some actions ,i get full of lots alpha channels

i would like to delete them all , and continue to work on the same image

do these script work in my case too?
is there an action that could do the same job?

thanks Jonas
cheers

Last edited by mantra; 02-25-2012 at 02:28 AM.
Reply With Quote top
  #12  
Old 02-25-2012, 03:17 AM
Der_W's Avatar
Der_W Der_W is offline
Senior Member
 
Join Date: Jul 2009
Location: Germany
Posts: 558
Re: A way to delete all alpha channels at once?

Hi Mantra :-),

so you have a bunch of alpha channels in your image that you don't need and want to get rid of them without messing with any of your attached masks etc.?
That's exactly what the above script does :-).
Again, actions won't work because they need the names of the alpha channels that need to be deleted, but the script should work just fine :-).

In fact I once created a "Megaflatten" script that'll get rid of all the alpha channels, paths, color samplers (which get saved in JPEGs otherwise!), layer comps, layers and guides (the guides were a little tougher because you can't delete them when there are none, so I first created a guide to be on the safe side and deleted all of them after that ;-)).
You might just pick the lines you need from it and save it as anything.jsx :-).
Also you'll get a history snapshot called "BACKUP" that'll contain everything you had before you ran the script but doesn't get saved (i.e. when you close the file, it'll get lost, no matter in what format you save it!).

Quote:
#target photoshop
app.bringToFront();
var theImage = app.activeDocument;

// Create a new history state called "BACKUP"

var idMk = charIDToTypeID( "Mk " );
var desc2 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idSnpS = charIDToTypeID( "SnpS" );
ref1.putClass( idSnpS );
desc2.putReference( idnull, ref1 );
var idFrom = charIDToTypeID( "From" );
var ref2 = new ActionReference();
var idHstS = charIDToTypeID( "HstS" );
var idCrnH = charIDToTypeID( "CrnH" );
ref2.putProperty( idHstS, idCrnH );
desc2.putReference( idFrom, ref2 );
var idNm = charIDToTypeID( "Nm " );
desc2.putString( idNm, "BACKUP" );
var idUsng = charIDToTypeID( "Usng" );
var idHstS = charIDToTypeID( "HstS" );
var idFllD = charIDToTypeID( "FllD" );
desc2.putEnumerated( idUsng, idHstS, idFllD );
executeAction( idMk, desc2, DialogModes.NO );

// flatten the layers

theImage.flatten();

// delete alphas

theImage.channels.removeAll();

// delete paths

theImage.pathItems.removeAll();

// delete layercomps

theImage.layerComps.removeAll();

// delete color samplers

theImage.colorSamplers.removeAll();

// clear guides

// create a guide first...

var idMk = charIDToTypeID( "Mk " );
var desc2 = new ActionDescriptor();
var idNw = charIDToTypeID( "Nw " );
var desc3 = new ActionDescriptor();
var idPstn = charIDToTypeID( "Pstn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc3.putUnitDouble( idPstn, idPxl, 0.000000 );
var idOrnt = charIDToTypeID( "Ornt" );
var idOrnt = charIDToTypeID( "Ornt" );
var idVrtc = charIDToTypeID( "Vrtc" );
desc3.putEnumerated( idOrnt, idOrnt, idVrtc );
var idGd = charIDToTypeID( "Gd " );
desc2.putObject( idNw, idGd, desc3 );
executeAction( idMk, desc2, DialogModes.NO );

// ... and now clear all of them

var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID( "Gd " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Al " ) );
desc.putReference( charIDToTypeID( "null" ), ref );
executeAction( charIDToTypeID( "Dlt " ), desc, DialogModes.NO );
Reply With Quote top
  #13  
Old 02-25-2012, 05:32 AM
mantra's Avatar
mantra mantra is offline
Senior Member
 
Join Date: Apr 2010
Location: Rome
Posts: 285
Thumbs up Re: A way to delete all alpha channels at once?

Quote:
Originally Posted by Der_W View Post
Hi Mantra :-),

so you have a bunch of alpha channels in your image that you don't need and want to get rid of them without messing with any of your attached masks etc.?
That's exactly what the above script does :-).
Again, actions won't work because they need the names of the alpha channels that need to be deleted, but the script should work just fine :-).

In fact I once created a "Megaflatten" script that'll get rid of all the alpha channels, paths, color samplers (which get saved in JPEGs otherwise!), layer comps, layers and guides (the guides were a little tougher because you can't delete them when there are none, so I first created a guide to be on the safe side and deleted all of them after that ;-)).
You might just pick the lines you need from it and save it as anything.jsx :-).
Also you'll get a history snapshot called "BACKUP" that'll contain everything you had before you ran the script but doesn't get saved (i.e. when you close the file, it'll get lost, no matter in what format you save it!).
Thanks SIR!

Last edited by mantra; 02-25-2012 at 05:51 AM.
Reply With Quote top
  #14  
Old 03-05-2012, 06:07 PM
shift studio's Avatar
shift studio shift studio is offline
Senior Member
 
Join Date: Feb 2009
Location: Calgary, Canada
Posts: 389
Re: A way to delete all alpha channels at once?

Hi Der_W
Thanks for posting your script! It's pretty slick.
When I run it as you posted above, I get a few errors in the variable assignment stage. (see attached as an example).
When I removed the "Create a new history state called "BACKUP"" and the "Clear Guides" sections, the script runs nicely but obviously doesn't create the history state or clear the guides.

Any idea why I'm getting these errors?

Thanks, Shift Studio.
Attached Images
File Type: jpg MegaFlattenScriptError.jpg (14.6 KB, 41 views)
Reply With Quote top
  #15  
Old 03-06-2012, 08:54 AM
Der_W's Avatar
Der_W Der_W is offline
Senior Member
 
Join Date: Jul 2009
Location: Germany
Posts: 558
Re: A way to delete all alpha channels at once?

Hi Shift,

unfortunately I can't reproduce your error message here at my PC.
I first thought it might be due to the script being created for German versions of Photoshop, but after switching to my English version, it's still running fine.

Therefore if you feel comfortable with it, you could try recording the missing parts yourself (it's not that difficult, most of the steps are automated and you just need to find out, which parts you need :-)).
For this you'll have to copy the file Scripting\Utilities\ScriptListener.8li into your Plug-ins\Automate folder.
Now restart Photoshop, open any image and create a simple guide anywhere in it. Now go to "View"-"Clear guides" to clear all guides. Create a new history snapshot and call it "BACKUP" or whatever name you like.
Next close Photoshop and look for a file called "ScriptingListenerJS.log" (on my Windows PC it's stored on my Desktop).
In it you'll see the individual commands you did, each separated by
Quote:
// =======================================================
, so it should be relatively easy to identify the different parts.
First thing you should see will be the open operation. You don't need that.
Next comes the creation of the guides and after that clearing them. Since you need both, just copy those blocks and replace them in my script.
The last useful block should be the creation of the backup state, you should see "BACKUP" somewhere in the block, so it's probably easy to identify.
Replace the according block in my script as well.
Now it should work, but there's one very important step missing! Either delete the ScriptListener.8li file from your "Automate" folder or put a "~" in front of the filename. Otherwise it'll run every time you start Photoshop and record everything you do as actions, which slows down Photoshop quite a lot!

I hope that helps and you can work with my instructions, otherwise we'd maybe have to do a screen sharing or something like that and try to get it to work :-).
Reply With Quote top
  #16  
Old 03-06-2012, 10:40 AM
shift studio's Avatar
shift studio shift studio is offline
Senior Member
 
Join Date: Feb 2009
Location: Calgary, Canada
Posts: 389
Re: A way to delete all alpha channels at once?

Hey, that worked like a charm.
I the syntax looks similar except for some indents...
Is it okay if I post the .jsx file here for PS CS5 on OSX 10.7.x ?

Thanks for sharing your knowledge and time!
--Shift Studio.
Reply With Quote top
  #17  
Old 03-07-2012, 08:21 AM
Der_W's Avatar
Der_W Der_W is offline
Senior Member
 
Join Date: Jul 2009
Location: Germany
Posts: 558
Re: A way to delete all alpha channels at once?

Of course you can post your version here, it'd be great to have a working script for Macs as well, since you're probably not the only one who had trouble with the PC version :-).
Reply With Quote top
  #18  
Old 03-07-2012, 11:29 AM
shift studio's Avatar
shift studio shift studio is offline
Senior Member
 
Join Date: Feb 2009
Location: Calgary, Canada
Posts: 389
Re: A way to delete all alpha channels at once?

Alright, here is the MegaFlatten script as described above, works in PS CS5 on OSX.

--Shift Studio.
Attached Files
File Type: zip MegaFlatten_OSX.zip (1.2 KB, 94 views)
Reply With Quote top
  #19  
Old 01-25-2013, 01:58 PM
antoniomitalia antoniomitalia is offline
Junior Member
 
Join Date: Jan 2013
Posts: 1
Cool Re: A way to delete all alpha channels at once?

Great Der_W!!!, I have registered on this site just to post a big THANK YOU on the forum. We really apreciate this share!!! EyesMeal.com
Reply With Quote top
  #20  
Old 04-17-2013, 04:56 AM
mantra's Avatar
mantra mantra is offline
Senior Member
 
Join Date: Apr 2010
Location: Rome
Posts: 285
Re: A way to delete all alpha channels at once?

hi

i don't know but this script doesn't delete guides
it blocks with an error
Attached Images
File Type: jpg error.jpg (19.0 KB, 16 views)
Attached Files
File Type: zip jonas script.zip (637 Bytes, 11 views)
Reply With Quote top
Reply

  RetouchPRO > Technique > Photo Retouching


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Misaligning color channels on purpose Peer K Photo Retouching 11 01-21-2010 07:12 AM
Dodging and Burning on Channels? snook305 Photo Retouching 8 04-30-2009 03:13 AM
additional color layer in channels palette? danii Photo Retouching 4 06-27-2008 06:52 AM
I'd like a tutorial on Gradiated (sp?) alpha channels. pixeltickler RP Tutorials 1 12-28-2003 12:28 AM


All times are GMT -6. The time now is 05:50 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
Copyright © 2016 Doug Nelson. All Rights Reserved