RetouchPRO

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


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

Reply
 
Thread Tools
  #1  
Old 03-24-2010, 03:11 AM
flexmanta's Avatar
Senior Member
 
Join Date: Dec 2009
Location: Spain
Posts: 339
A way to delete all alpha channels at once?

Hi all.

I am trying to come up with a way to include a command in my flattening action that deletes all alpha channels in a psd document.


The idea is to be able to select a bunch of psd from the bridge and, by the use of the image processor, batch save them all as flattened tiff. That's the easy part. I noticed that not all alpha channels get deleted during flattening and since the image processor doesn't give an option whether to preserve layers or not, I end up with bigger files to upload back to the clients and the size difference is noticeable.

Basically i need a command tho include in my action, that will delete all alpha channels regardless of their names so that i don't have to do it one by one.

Thanks
Reply With Quote
  #2  
Old 03-24-2010, 03:17 AM
Der_W's Avatar
Senior Member
 
Join Date: Jul 2009
Location: Germany
Posts: 528
Re: A way to delete all alpha channels at once?

With actions alone its not possible, but you could use a script like this:

Quote:
Originally Posted by Save as Channels.jsx
#target photoshop
app.bringToFront();
var theImage = app.activeDocument;
theImage.channels.removeAll();
You can record the script by using "File"-"Scripts"-"Browse" and choosing the Channels.jsx file.
Reply With Quote
  #3  
Old 03-24-2010, 03:44 AM
flexmanta's Avatar
Senior Member
 
Join Date: Dec 2009
Location: Spain
Posts: 339
Re: A way to delete all alpha channels at once?

Amazing, you just saved me a lot of time.
Thanks
Reply With Quote
  #4  
Old 03-24-2010, 12:15 PM
DJSoulglo's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Amsterdam
Posts: 410
Re: A way to delete all alpha channels at once?

Is there also a way to delete all paths from an image, because that would be awesome....
Reply With Quote
  #5  
Old 03-24-2010, 12:47 PM
Der_W's Avatar
Senior Member
 
Join Date: Jul 2009
Location: Germany
Posts: 528
Re: A way to delete all alpha channels at once?

Of course there is :-)

Quote:
Originally Posted by Save as Paths.jsx
#target photoshop
app.bringToFront();
var theImage = app.activeDocument;
theImage.pathItems.removeAll();
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.
Reply With Quote
  #6  
Old 03-24-2010, 02:15 PM
Senior Member
 
Join Date: Jan 2006
Location: chicago
Posts: 1,098
Re: A way to delete all alpha channels at once?

can someone upload a copy of this script?
Reply With Quote
  #7  
Old 03-24-2010, 06:49 PM
flexmanta's Avatar
Senior Member
 
Join Date: Dec 2009
Location: Spain
Posts: 339
Re: A way to delete all alpha channels at once?

Why a copy? Just open a text editor (notepad), paste this:

#target photoshop
app.bringToFront();
var theImage = app.activeDocument;
theImage.channels.removeAll();


And save the file as whatever.jsx. Then in photoshop, run that script by doing File->Scripts->Browse. You might aswell record an action while you call the script.

In fact, now i have this action that i use from the bridge to create a bunch of flat TIFF. Select the images, then use the image processor and set it to save as tiff with LZW compression and have it run an action like this one:

1.Flatten Image.
2.Delete alpha channels (by using the script).
3.Convert to desired color profile.
4.Set mode to 8bit.

That way, when I'm assigned a whole series of photos for retouch, i don't have to open them one by one to create the tiff files to send to the client.
Reply With Quote
  #8  
Old 03-24-2010, 07:17 PM
Senior Member
 
Join Date: Sep 2005
Location: outside of the box.
Posts: 628
Re: A way to delete all alpha channels at once?

you can also record actions that delete paths, channels, changes bit mode, converts etc. etc.....and go to "automate" "batch" "create droplet".

it will create a little icon that you can save on your desktop or in your job folder....and all you have to do, when ready to supply final files to clients....is just drag the opened or unopened psd files onto this little droplet icon and PS will do all the work for you. It will run the appropriate action you assign and save the "final files" for delivery wherever you assign it to.
Reply With Quote
  #9  
Old 03-25-2010, 05:35 AM
flexmanta's Avatar
Senior Member
 
Join Date: Dec 2009
Location: Spain
Posts: 339
Re: A way to delete all alpha channels at once?

Good stuff KR1156! Quick flat tiff files with no alphas or paths... the way it should be.

Now just one more question for total perfection. Is there any way to hook the bridge to an ftp to see remote folders? That would be a really nice feature!
Reply With Quote
  #10  
Old 03-25-2010, 08:32 AM
DJSoulglo's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Amsterdam
Posts: 410
Re: A way to delete all alpha channels at once?

Genius. These 2 scripts are just genius. Thank you very very much.
Reply With Quote
  #11  
Old 02-25-2012, 01:07 AM
mantra's Avatar
Senior Member
 
Join Date: Apr 2010
Location: Rome
Posts: 135
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 01:28 AM.
Reply With Quote
  #12  
Old 02-25-2012, 02:17 AM
Der_W's Avatar
Senior Member
 
Join Date: Jul 2009
Location: Germany
Posts: 528
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
  #13  
Old 02-25-2012, 04:32 AM
mantra's Avatar
Senior Member
 
Join Date: Apr 2010
Location: Rome
Posts: 135
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 04:51 AM.
Reply With Quote
  #14  
Old 03-05-2012, 05:07 PM
shift studio's Avatar
Senior Member
 
Join Date: Feb 2009
Location: Calgary, Canada
Posts: 254
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, 25 views)
Reply With Quote
  #15  
Old 03-06-2012, 07:54 AM
Der_W's Avatar
Senior Member
 
Join Date: Jul 2009
Location: Germany
Posts: 528
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
  #16  
Old 03-06-2012, 09:40 AM
shift studio's Avatar
Senior Member
 
Join Date: Feb 2009
Location: Calgary, Canada
Posts: 254
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
  #17  
Old 03-07-2012, 07:21 AM
Der_W's Avatar
Senior Member
 
Join Date: Jul 2009
Location: Germany
Posts: 528
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
  #18  
Old 03-07-2012, 10:29 AM
shift studio's Avatar
Senior Member
 
Join Date: Feb 2009
Location: Calgary, Canada
Posts: 254
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, 13 views)
Reply With Quote
Reply

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 06:12 AM
Dodging and Burning on Channels? snook305 Photo Retouching 8 04-30-2009 02:13 AM
additional color layer in channels palette? danii Photo Retouching 4 06-27-2008 05:52 AM
I'd like a tutorial on Gradiated (sp?) alpha channels. pixeltickler RP Tutorials 1 12-27-2003 11:28 PM


All times are GMT -6. The time now is 06:20 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.2
Copyright © 2008 Doug Nelson. All Rights Reserved