Re: Photoshop Channels help
Re: Photoshop Channels help
- Subject: Re: Photoshop Channels help
- From: Stan Cleveland <email@hidden>
- Date: Wed, 09 Nov 2005 16:05:21 -0800
- Thread-topic: Photoshop Channels help
On 11/9/05 9:31 AM, "Timothy K. Wilkinson" <email@hidden> wrote:
> I'm trying to create a script that will copy the data from a single channel
> in a document and then paste it in the same channel only in a new document.
> We do this a lot with images taken on a microscope using red, green and blue
> filters.
>
> I've been able to spilt the original into channels, make a new document and
> then paste the data into that document. The problem is that I only want to
> paste the data into the green channel but it pastes it in every channel.
>
> Does anyone know how to tell Photoshop to only paste into a certain channel?
> I've tried setting the visible of the other channels to false but that
> hasn't worked....<snip>
Below is some code to get you started that will, hopefully, be useful. As
written, it will make an exact duplicate of an RGB image, moving just one
channel at a time. It assumes RGB mode; doesn't use "copy" and "paste"
commands, which I always try to avoid; and gives you the opportunity to
manipulate each channel as it is moved. The code can easily be modified to
use three different souce documents, rather than a single one, if desired.
tell application "Adobe Photoshop CS2"
-- get properties of sourceDoc
set sourceDoc to current document
tell sourceDoc
set x to width as pixels
set y to height as pixels
set r to resolution
set current layer to layer 1 -- if needed
end tell
-- create matching targetDoc
set targetDoc to make new document with properties ¬
{resolution:r, mode:RGB, width:x as pixels, height:y as pixels}
tell targetDoc
delete channel 3
delete channel 2
-- must leave one channel
end tell
-- bring channels over, one by one
repeat with i from 1 to 3
set current document to sourceDoc -- must be frontmost
tell sourceDoc
set current channels to {channel i}
set newChannel to duplicate current channels to targetDoc
end tell
-- manipulate new channel in new document, if desired
set current document to targetDoc -- must be frontmost
tell newChannel
-- place your manipulation code here
end tell
end repeat
-- set color space of targetDoc
tell targetDoc
delete channel 1 -- dump remaining channel from above
repeat with i from 1 to 3
set properties of channel i to {kind:component channel ¬
, name:item i of {"Red", "Green", "Blue"}}
end repeat
change mode to RGB
end tell
end tell
--
Stan Cleveland <email@hidden>
Color Technology Inc., Portland, Oregon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden