C#, COM, and Photoshop Channels

Hey all,

I’m attempting to write a tool in C# that needs to access a Photoshop document’s channel data. I’m trying to mainpulate the Photoshop.Document.ActiveChannels member. The VBScript Reference says ActiveChannels takes an array of Channel objects, but when I type:

Photoshop.Channel[] currChannels = myDoc.ActiveChannels;

I get an error saying I can’t turn type ‘object’ into type ‘Photoshop.Channels[]’.

Anyone deal with this in the past that can help give me some insight? Any help would be greatly appreciated!

appRef.ActiveDocument.ActiveChannels = array(appRef.ActiveDocument.channels(4))

this will set the active channel to channel 4 in vbs.

I hope this helps, sorry the reference is in vbs but I don’t really know any C#. :D:

Well, I did manage to ultimately figure something out.

What I’ve done is declare an object and house the current layers in that object. That way, I can switch the channels by loading that variable.

It looks a little something like this:


// stores the current active channels
object currentChannels = myDoc.ActiveChannels;

// gets a stored set of active channels
myDoc.ActiveChannels = currentChannels;

I just make sure that, whenever I make a channel I want to save (like with alphas), I save it on creation.

It’s a bit of a hack, and I’d rather know what data’s actually being passed, but it does work.

Can you not use System.Reflection to get that?

Over the past few years, the center has been the appointed hotel for many international events, such as the 49th World Team Table-Tennis Championship and the 2009 Sudirman Cup World Team Badminton wow powerleveling Championship.

Mana outgo low by 12% almost wow gold . Invisibleness: Can no someone be interrupted by a uncongenial process or change finished during the 3 wares disappear instance, yet an occult mage can works be stupefied or silenced to get threepenny wow gold . Mirror Representation: Images present no yearner induction the ending safe when their measure expires.