Re: Photoshop layer mask scripting - stumped
Re: Photoshop layer mask scripting - stumped
- Subject: Re: Photoshop layer mask scripting - stumped
- From: Luca Pozzato <email@hidden>
- Date: Wed, 15 Sep 2004 15:19:01 +0200
Title: Re: Photoshop layer mask scripting - stumped
Hi,
Maybe by now you have a better solution then the following
Assuming that you have two psd files opened with the following names and layers
file 1: name : "A.psd" --Layer "A" with layer Mask, Layer "C"
file 2: name : "B.psd" --Layer "A" without layer Mask, Layer "B"
here is the script--
tell application "Adobe Photoshop 7.0"
activate
set MyDoc to document "A.psd"
set current document to MyDoc
set LayerList to get every art layer of MyDoc
repeat with layerref in every item of LayerList
if name of layerref is "A" then
set current layer of MyDoc to layerref
duplicate current layer of MyDoc to after layer "A" of document "B.psd"
set current document to document "B.psd"
set x to index of current layer of current document
-- you should clean up the contents of incoming layer and reset the transparancy option if required
set y to x - 1
merge art layer y of current document
return
end if
end repeat
end tell
ciao
Luca
> From: Roger Howard <email@hidden>
> Date: Mon, 13 Sep 2004 17:12:22 -0700
> To: AppleScript Users Mailing List <email@hidden>
> Subject: Photoshop layer mask scripting - stumped
>
> Ok, so far I've been able to eventually come to grips with the vagaries
> and idiosyncrasies in Photoshop CS. I'm a longtime Photoshop user and
> trainer, but wrestling with the scripting implementation sometimes
> feels like a parallel tool more than a logical exposing of the
> underlying object model. Anyway, I digress...
>
> Today, my goal is relatively straightforward, or so I thought. Here's
> the simplified scenario:
>
> I have two files; each file has 2 or more layers; let's call these
> files A and B
> A and B have the same number of layers, named the same way, none of
> which are in layer sets
> In A, every layer has a layer mask
> In B, layers may or may not have layer masks
>
> The goal: to transfer the layer mask from each layer in A to the layer
> of the same name in B.
>
> If I were doing it manually:
>
> 1) Select the target layer in B
> 2) Select the source layer in A; load its layer mask as a selection
> 3) Use Save Selection to save the current selection (in A) into the
> layer mask of the selected layer in B
>
> Unfortunately, I'm at a standstill. I cannot even find a way to
> reference a layer's layer mask, as a property or child of the layer
> object. The only way I can figure out how to load a layer mask as a
> selection via AppleScript is to set the current layer, then use an
> Action to Load Selection - not ideal. Likewise, I cannot see how to
> transfer this selection to a layer mask in another document, primarily
> because, again, I have no clue how to reference Layer Masks.
>
> Even though a layer mask can be worked with as a pseudo channel in
> Photoshop, layer masks don't appear to be included in the channels
> object - so even when I see 4 channels (3 for RGB, plus an italicized
> Layer Mask channel) iin the channels palette, getting (names of every
> channel) does not include the layer mask.
>
> I don't need help with the logic of the script, so I haven't even
> bothered to post any code here - I'm just grappling with the object
> model. Any Photoshop scripters out there please take mercy!
>
> First, how do I get a layer mask of a layer?
> Since there's a load selection, but not a save selection, command in
> the object model, is it possible to use this to copy a selection over?
> Otherwise, what's the fastest way to transfer a selection from one
> document to another (specifically, from a layer mask in one document to
> a layer mask in another)?
>
>
>
> There's the really ugly and slow way which I can piece together using
> judicious use of the clipboard and Actions, but I'd really rather not -
> mostly because I hate feeling defeated by an object model :)
>
> roger howard
> email & im @ <email@hidden>
> photos @ <http://www.pbase.com/rogerhoward>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Applescript-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> a.it
>
> This email sent to email@hidden
>
_______________________________________________
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