Copy and paste channels - how to?

So, I myself wrapped around the axle here to try to understand the channels. I can't get my head around the fact that you can duplicate, add and remove, but you can't copy and paste the content of the channel? I work in the JS in CS3. Or trying to.

I'm taking a gray image with three channels and reduce to two. Channel 2 channel 1 copy, copy 3 2 channel, then delete the channel 3 and save the file.

Why does this work? I can copy and paste of artlayers so the method exists, but for some reason some can't seem to accept this method for channels:

Alpha 1 of copy and paste in Gray
app.activeDocument.channel [2] corresponding ();
app.activeDocument.channel [1] .paste ();

Alpha 2 to copy and paste it into Alpha 1
app.activeDocument.channel [3] corresponding ();
app.activeDocument.channel [2] .paste ();

Remove the old channel Alpha 2
app.activeDocument.channel [3] .remove ();

I tried another way - setting the active channel and then copy and paste, but I couldn't even fix the active channel without error:


app.activeDocument.activeChannels = app.activeDocument.channel [2];

Very stuck and need some help. Thank you.

It does work for a lot of reasons. Channels and almost everything else start with 0. To use an index, you must use channels. The class of the channel does not have a copy method. And finally activeChannels expects an array.

It is therefore easy fixes for everything except the copy method. For this we need to use scriptlistner to make an applyImage function. When you apply an image in normal mode, it is the same as the copy without using the Clipboard.

// assumes grayscale mode with two alpha channels
// make gray channel active
app.activeDocument.activeChannels = [app.activeDocument.channels[0]];
// copy first alpha contents to gray
applyChannelByName( app.activeDocument.channels[1].name );
// make first alpha channel active
app.activeDocument.activeChannels = [app.activeDocument.channels[1]];
// copy second alpha content to frist alpha
applyChannelByName( app.activeDocument.channels[2].name );
// remove the second alpha
app.activeDocument.channels[2].remove();
// make gray channel active
app.activeDocument.activeChannels = [app.activeDocument.channels[0]];

function applyChannelByName( name ) {
    var desc = new ActionDescriptor();
        var applyDesc = new ActionDescriptor();
            var ref = new ActionReference();
            ref.putName( charIDToTypeID('Chnl'), name);
        applyDesc.putReference( charIDToTypeID('T   '), ref );
        applyDesc.putBoolean( charIDToTypeID('PrsT'), true );
    desc.putObject( charIDToTypeID('With'), charIDToTypeID('Clcl'), applyDesc );
    executeAction( charIDToTypeID('AppI'), desc, DialogModes.NO );
}

Tags: Photoshop

Similar Questions

  • How to copy and paste a blog to send in an email?

    Never have copy pasted something on Mozilla Firefox (or any other site) I'm completely ignorant of how to do it!
    Somebody directed me to his blog and suggested I send a large part of the content to a third party by using the "copy and paste". How can I do this? Please keep the simple instructions that my basic knowledge is really basic. Thank you.

    Generally, you use the mouse to select text, first of all, as you would in any other application. (To select the entire contents of a page, you can press Ctrl + a, but which would include an extra material of the headers and footer sidebars, so probably not useful on a ticket of a blog.)

    Once you have selected what you want to copy, and then copy it by using one of these common methods of Windows:

    CTRL + c

    Right click > copy

    Edit > copy

    To paste into your email, once you have clicked where you want in the message, the same approach should work in most Windows programs:

    CTRL + v

    Right click > paste

    Edit menu > paste

    (Some programs may also have an icon on the toolbar to paste.)

    Now... some potential problems.

    First of all, when you select a web page, highlighting that indicates the selection can pull in sidebars or can jump a few images, etc. It all depends on how the web page was built. It might take a couple of copy and paste to isolate only the part that you care without picking up a bunch of junk.

    Second, web pages can include scripts and plugin content like Flash animations that are not allowed by some e-mail programs. For example, in Microsoft Outlook, these elements can generate a security warning. Then you have to work around those if you see in your selection.

    Finally, some people have added a script to their page that appears when you right-click and notifies you that it is copyrighted. In this case, use one of the other methods for copy.

    Does it work?

  • How to copy and paste into the search engine does not work?

    How to copy and paste into the search engine does not work?

    It should be.

    Restart your Mac and try again.

    Other than that, make sure that OS X is updated.

    Open the App Store, and then select the updates menu.

  • How to copy and paste from Thunderbird.

    Hello

    I know that this may seem obvious, but my question is not how to copy / paste because I know that orders.

    The problem is that whenever I have copy and paste all the texts that it sticks adds an extra space in it, so I need to go and remove the space, so it would be normal and not double spacing.

    I tried searching all possible options, but could not find any way for texts get pasted correctly.

    Any help would be appreciated!

    Open Tools/Options/Advanced/general/Config. Editor and double-click the preference layout.word_select.eat_space_to_next_word to activate it false.

    http://KB.mozillazine.org/layout.word_select.eat_space_to_next_word

    Same thing for Firefox, if you wish.

  • How to recover my editing functions, copy and paste, without doing a restore?

    When I switched to Firefox 4 I have more the file, edit, etc. anywhere features. I can not or do not know how to copy and paste websites to emails for example without editing functions.

    Looks like you have the hidden menu bar.
    If the Firefox (orange - top left corner) button is visible - click it and go to options and check menu bar.

  • WHEN YOU USE THE CONSTRUCTOR OF MY SITE, I CAN'T COPY AND PASTE WROTE THE BROWSER SECURITY SETTINGS HOW TO NOT CHANGE THESE FOR ME TO COPY / PASTE?

    WHEN YOU USE THE CONSTRUCTOR OF MY SITE, I CAN'T COPY AND PASTE WROTE THE BROWSER SECURITY SETTINGS HOW TO NOT CHANGE THESE FOR ME TO COPY / PASTE?

    https://support.Mozilla.com/en-us/KB/granting+JavaScript+access+to+the+Clipboard

    This extension will help you implement the security policies for access to the Clipboard.

    Allow the extended Clipboard support:

    https://addons.Mozilla.org/en-us/Firefox/addon/852

  • How copy and paste on Android?

    When I reviewed various sites it is often necessary to copy text from a web page or paste text elsewhere on the phone (for example, a password manager application) into a form on a web page. When you use the stock Android browser, this is usually accomplished by a long click on the text or shape. However, when you use Firefox, it doesn't matter. So I would like to know how, when using Firefox on Android, I can copy and paste text. Please keep in mind that the phone that I use - HTC Evo - is a touchscreen device and that there is no physical keyboard.

    Thanks for any help.

    We have recently added the ability to copy and paste into web forms: https://bugzilla.mozilla.org/show_bug.cgi?id=611741

    This change will be included in the next update which we communicated through the Android Market, or you can test it now in our nightly builds.

  • HP Jet 11-D007NA: How do I copy and paste in Windows 10 with left and right keys

    Hi Everyone,                                                                                                                27/08/15

    I know the c control and control functions v for copy and paste with Excel and Word. How do cut you, copy, and move entire folders when you are working in Windows 10? 2 tapping fingers at the same time used to work in point 8.1 of Windows but does not work in Windows 10. I want to move my documents together and download files from my drive c on a memory stick that I have only 32 GB SSD in my book and it is fill up very quickly. I don't want to lose days copy individual files and sticking them in the memory stick. That would be a common mistake. I don't understand why HP had to remove the left and right buttons and make life very difficult for its customers. They probably saved a couple of hundred by getting rid of the buttons in their calculation of costs, but made it impossible for customers to use the laptop in a productive way.

    Vijpat10

    Have you tried pressing the right and left of the touchpad corners? Most of the models without physical buttons have this function.

  • How can I copy and paste a local variable in a custom type?

    I have a variable container that I want to copy and paste into a custom data type. So I opened the window Type of TestStand, expand the Custom Data Types and then right-click on and Paste in my context menu is disabled. How can I get my exact data type it?

    Hello

    A work around:

    Create a container type in the custom data types.

    Under which I could copy the container.

    It will be useful.

    Ravi

  • How to copy and paste text from the page of the book one photo to another.

    Hello, I downloaded this software 2 days ago, and I had so much fun with it. pls I need help on how to copy and paste text from the page of the book one photo to another. Second, how to copy my photo book completed pages project to another laptop computer for printing. Thank you

    Wow! I solved the first problem, I clicked on 'ctrl c' to copy and "ctrl v" to paste. yipppppeee! now am loving this software d most just need help with the second question now

  • I have windows 7 on a HP laptop. I would like to know how to copy and paste on an e-mail. Thank you.

    I have windows 7 on a HP laptop. I would like to know how to copy and paste on an incoming e-mail and send back with some documents that are in my files. I need to send these documents, which are in my files, where the email came. I need to put these documents in this e-mail entering and then returning it to them. The documents folder is PDF, whatever that means. Thank you

    Hi josephbronsard,

    Thanks for posting in the Microsoft community! I'll do my best to help you with the question that you have.

    Windows operating system you are using?

    Who is the provider of mail service?

    You can click on the button answer on the email address and then attach the file you want to send and click Send.

    Please answer us with more information to help you. Please answer questions from Ken:

     

    We can't wait to hear back on your part.

  • Snip can be used to copy and paste If yes how

    original title: snip

    Snip can be used to copy and paste If yes how

    Hello

    I guess that you are talking about the tool captures.

    Open the capture tool , and then select Options.

    Place a check mark to always copy shears in the Clipboard.

    Click OK.

    Click new, select the part of the screen that you want to cut out. When you release the mouse button, the selected area will be copied to the Clipboard.

    Open a program that can display images (Paint, Wordpad, MS Word, etc.).

    Right click in the program and select Paste.

    The area of the screen that you snipped will be pasted into the program.

    Let us know the results.

    Concerning

  • I forgot how to copy and paste, lost my book. Help, please!

    I need to confirm a request that I did and need to copy and paste address http, misplaced my book How do. Called several people and they don't know. We are all seniors. Help, please!

    Highlight the http address to copy by placing the mouse pointer at the beginning, press and hold the left mouse button and drag the address at the end of this one.  Now place your mouse over the highlighted text and right click. In the context menu, click on copy.  Move where you want to paste the address and right click and click on paste.

    There are other ways to do it, but this seems more intuitive for many people.

  • How can I copy and paste to an employment application that has no 'attachments '.

    I know how to copy and paste to add a RESUME for a job application that does not have the 'attachments' option.  Y at - it a simple explanation on how to copy and paste to an online employment application.

    Hello

    It is a very good tutorial step by step for you to copy and paste.

    «How to copy, cut and paste in Windows»

    http://www.bleepingcomputer.com/tutorials/cut-copy-and-paste-in-Windows/

    How to highlight text in a document

    Before you copy, cut or paste text data, that you need to be able to highlight, or select, the text that you want to run the action. This is called putting in value and allows you to select information in a document or parts thereof. Once the text is highlighted you can then copy or cut the information according to your needs. An example of this highlighted text looks like below:


    Figure 1: Example of highlighted text

    And you can use Ctrl + C to copy, and then Ctrl + V to paste.

    See you soon.

  • I lost some data during a copy and paste procedure between folders on a thumb drive... any ideas how to recover this data?

    I lost some data during a copy and paste procedure between folders on a thumb drive... any ideas how to recover this data?

    I lost some data during a copy and paste procedure between folders on a thumb drive... any ideas how to recover this data?

    If you did a copy and paste, the original files are left intact when they came.  If you did a cut and paste, they are lost if you do not paste them and your paperweight (the location of storage to copy or cut and paste) was allowed.  It would be cleared if you did quite exemplary or cuts too fill it, or if you rebooted.

Maybe you are looking for