Photoshop - combine images channel purple and green in a fused image?


My molecular biology laboratory trying to image fusion from a Confocal Microscope batch.  The microscope uses lasers to view different parts of a sample in a number of channels.

For each sample, there are two corresponding channels at each level.  We try all these corresponding images merge into one combined image.  The image fusion process is simple; However, we must do this 150 - 250 times for each sample and we have several samples.

I found an old post on the forum (Photoshop - combine images red and green layer in a fused image? ) which causes the writing a script for exactly this.  However, the script does not work for me.  I'm new to using scripts in photoshop and would appreciate greatly all possible assistance.

Here is the code I tried to run.

// make a reference to the savedFolder  
var savedFolder = new Folder('~/desktop/Merged Image');  
// create the folder if it doesn't exists  
if(!savedFolder.exists) savedFolder.create();  
// get the source folder from the user and store in variable  
var sourceFolder = Folder.selectDialog();  
// make sure user selected a folder  
if(sourceFolder != null){  
    // get an array of red images and store in variable  
    var sourceFiles = sourceFolder.getFiles(/_ch00\.tif$/i);  
    // make a loop to process all found sets.  
    for(var i = 0; i < sourceFiles.length;i++){  
        var redName = sourceFiles[i].name;  
        var greenName = redName.replace('_ch00','_ch01');  
        var redImage = open(sourceFiles[i]);// open the red file and store reference to document  
        var greenImage = open(new File(sourceFolder+'/'+greenName));// open the green file and store reference that document  
        // now apply redImge using lighten mode  
        applyChannel( charIDToTypeID( "RGB " ) , );  
        // save the merged document  
        // close the open documents for next loop  
function applyChannel( channelID, documentName ){  
    // charIDToTypeID( "RGB " )  
    // charIDToTypeID( "Rd  " )  
    // charIDToTypeID( "Grn " )  
    // charIDToTypeID( "Bl  " )  
    var desc = new ActionDescriptor();  
    var channelsDesc = new ActionDescriptor();  
    var ref = new ActionReference();  
    ref.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Chnl" ), channelID);  
    ref.putProperty( charIDToTypeID( "Lyr " ), charIDToTypeID( "Bckg" ) );  
    ref.putName( charIDToTypeID( "Dcmn" ), documentName );  
    channelsDesc.putReference( charIDToTypeID( "T   " ), ref );  
    channelsDesc.putEnumerated( charIDToTypeID( "Clcl" ), charIDToTypeID( "Clcn" ), charIDToTypeID( "Lghn" ) );  
    channelsDesc.putBoolean( charIDToTypeID( "PrsT" ), true );  
    desc.putObject( charIDToTypeID( "With" ), charIDToTypeID( "Clcl" ), channelsDesc );  
    executeAction( charIDToTypeID( "AppI" ), desc, DialogModes.NO );  
function SaveAsTIFF( inFileName, inLZW ) {  
    var tiffSaveOptions = new TiffSaveOptions();  
    if ( inLZW ) {  
        tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW;  
    } else {  
        tiffSaveOptions.imageCompression = TIFFEncoding.NONE;  
    app.activeDocument.saveAs( File( inFileName ), tiffSaveOptions );  

Basically, everything I changed code original was the '_r' to '_ch00' and '_g' to '_ch01 '.  Thinking that the only difference between the original message and mine was the file name.  I executed the script in Adobe ExtendScript ToolKit.  The code is not able to go beyond the line 15 without the error "opening is not a function".

I tried to save the script and try it out in photoshop in any case and I get the error code "error 8800: general Photoshop error occurred." Maybe this feature is not available in this version of photoshop.  -The 'Apply Image' command is not currently available. Line 41-> executeAction (CharIDToTypeID ('Appl'), desc, DialogModes.NO); »

I honestly don't know enough about coding to know even where to begin to fix this problem.  Any direction would be much appreciated!

/ Steven


I use photoshop CS5.  I think I found the problem, however.  The files needed to be converted to RGB index for the script is running.  Seems to work fine now.  Thanks for the reply!

Tags: Photoshop

Similar Questions

  • Microsoft-new Xbox360-problem display of purple and green it is defective?

    I just bought a new xbox360 for Christmas and since the purchase, he showed color display only green and purple. Once when playing adventures with the kinect, all entered colors automatically, but it has not changed and when to use again another day it was back to the purple and green screen.  Not happy at all, the console was very expensive and should work fine.

    Woulds appreciate your advice or any information where I can get help for this problem thank you.


    It seems that the cables may need to be plugged in all the way.  In addition, please make sure that the colors are adapting successfully.  Connect it to another TV.  If you still encounter problems with the console, I suggest to go back to the location that you bought.  I hope that this information is beneficial.

    Thank you

    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • Purple and green spots with the Nikon D700 raws

    I'm getting some purple and green spots (mostly purple) with Nikon D700 raws using the profile "Camera Standard". This often happens when the sunset-ish shots. The problem goes away when I select the 'Adobe Standard' profile.

    I just tried ACR 6.3 RC and the problem persists. is this a known issue?

    Would be happy to share if necessary crude + screenshots (currently on a low bandwidth connection)

    Thank you


    Kevin, please try these:

  • HP dv6 Notebook PC Envy: purple and green points on screen

    Hey guys,.

    For a little while now, I had green and purple points come on the screen. Randomly, he began to arrive and was not a cause to throw or something. They come on the screen, stay a while, disppear briefly and return. If he press the keyboard next to the mouse pad area it makes disppear for a little while.

    I also have a line of white pixels from top to bottom on the left side of my screen, perhaps a little more two inches to one side. Not so long ago, I called HP, but they didn't really help me.

    I can not screenshot them so I think it's a physical problem and not in display graphics software.

    Someone at - it ideas?  I'm on it!

    Thank you


    Hi @Benjamin95 ,

    Welcome to the HP support community! I hope your enjoy your experience with us.

    I saw your post about points violet/green and the white line. I'll be happy to help you. Yes, this could be a hardware problem. We can confirm that by connecting your laptop to an external monitor. If they come we know that there is a problem with the display. That they show it might be a software or graphic card problem.

    What is your product number? There are a number of models of the dv6 series.

  • I recently had a problem adding still png or jpg graphics - looks like that it is not synchronized and gives purple and green grounds.

    When you add a graphic to my FCPX video in the form of png or jpg or tiff, it looks like it does not synchronize according to the pic

    Maybe your graphics card struggled to display an image of grand res. What model is your Mac?

    Try to resize an image for something as small as a test. Preview can do the downsizing, or if you have an image editor like Photoshop...


  • Purple and black when you use any program, laptop is very slow

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas: my screen goes black purple and green when I open a program, that is to say when I go online a special writing of Web sites will be in purple, black and green? HO to fix this?

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    Maybe your graphics card is damaged. You have another card to test? "A programmer is just a tool that converts the caffeine in code" Deputy CLIP -

  • Photoshop cs6 images look dark and green when placed in a box.

    I just upgraded to PS CS6 and my images are looking dark and green when I download dropbox to send to clients for review.

    A screenshot of my image looks perfect in dropbox, but if I save it directly it looks terrible.

    Looks you Prophoto in the soup (and some management problems, labeled vs color vs viewers not tagged, color management is no color management)...

  • My Prem Pro program window image is blocky and green red yellow vertical bars when static - scrubs and exports ok... what's up?

    My Prem Pro program window image is blocky and green red yellow vertical bars when static - scrubs and exports ok... What is happening?

    This thread seemed to solve... (seems to be a question of el capitan). Super frustrating though, as I don't want to turn off automatic switching: Premiere Pro chart question?

    A lot of El Capitan being more respectful of the adobe!

  • I have Photoshop Elements 8.0, 11 AND 12 all installed on my computer.  Can I safely uninstall 8.0 and 11 without losing all the images?

    I have Adobe Photoshop Elements 8.0, 11 and 12 ALL installed on my computer.  Can I safely uninstall 8.0 and 11 without losing my photos?  I can't access 8.0.

    lindat83366006 wrote:

    I have Adobe Photoshop Elements 8.0, 11 and 12 ALL installed on my computer.  Can I safely uninstall 8.0 and 11 without losing my photos?  I can't access 8.0.

    Uninstalling a previous version of elements doesn't change anything on your image or catalog files.

  • Photoshop and elements 13 working in iPhoto you want to edit the image using photoshop elements is the next IPhoto &gt; Preferences &gt; advanced &gt; edit Photos: in the menu drop-down set in Photoshop elements also Ctrl click and chose to change in edit

    Photoshop and elements 13

    Work in iPhoto

    You want to change the image using photoshop elements

    Did the following

    1. IPhoto > Preferences > advanced > edit Photos: in the menu dropdown selected in Photoshop Elements
    2. Also control click on and chose edit in external editor
    3. List drop-down menu edit in the external program photos > photoshop Elements
    4. Go to the image, I work - is selected the image, the user has clicked on change. When nothing happened, I double click on the image. Elements has not opened yet. Then I opened the item editor, returned to iphoto and tried again the whole process. the photo has not yet opened the 13 elements for editing.
    5. I have 3 elements 13 books as well as watched online - all my references say exactly the same thing--iPhoto > Preferences > advanced > change in the external program > photoshop Elements
    6. I uninstalled and reinstalled both iPhoto as well as elements.

    I spoke with the technical support of application.  It seems that nothing wrong with my copy of iPhoto.  However there is no Adobe support.  I waited more than 1.5 hours for chat support several days ago and eventually abandoned.

    You are probably choose the manifest file and the correct file like PES Editor. The current editor is hidden inside the Support files folder. The PSE file at the top level of the PES in the Applications folder is simply an alias for the Welcome screen and what you describe is exactly what is happening when you who choose. You want this one:

  • Photoshop retains a recovery time and again the same image. How can I get him to stop?

    Photoshop retains a recovery time and again the same image. How can I get him to stop?

    I don't need the image. I tried to register on multiple locations.

    Looks like you have an orphaned recovery file. See thread

  • Pink and green lines when jpeg used in iMovie

    Hi all

    I have a strange problem that I can't find an answer to the internet. Whenever I used a file jpeg or png as a background or a picture in picture during a movie, to export the movie space where was the image file is replaced by a series of pink and green "buzzing" or flicking of horizontal lines. I just made that I have updated to the latest version of El Capitan and iMovie (10.1.1). An example of a jpeg file used as background and what looks like the export is attached. It looks good in the iMovie preview.

    Here I use the green screen feature, and it was a video test with just a microphone stand, move around.

    Thanks for any help!

    This type of problem has been tested with iMovie 11 running on El Capitan, but not with iMovie 10.1.1. You said that you went to 10.1.1 and are still seeing this problem. Try to create a new library and new project and see if you can reproduce the problem. Maybe your library 11 iMovie did not upgraded to 10.1.1 correctly.

  • Satellite A200 - please I need help, the screen goes pink and green

    Hello world

    I have a Satellite A200 and I have a problem with my screen. It appears suddenly pink and green and it resolves on its own or when I close the lid. It starts from the Toshiba logo before windows logon. Please help me, thanks in advance.


    You can try to find what's wrong with your laptop if you would connect it to the external monitor.
    If the same question would be visible on the second, the external monitor then this screen problem could be related to the graphics chip.

    If the image on the external monitor would be nice laptop computer s internal monitor could be faulty.

    However, in both cases, you must contact the ASP in your country for replacement.

    Good luck

  • Black and green

    I prepare the documents for accessibility, and now all my .pdf documents, I have open in Adobe Acrobat Professional have a black background and green text. How can I get this back to a white back ground with black text?

    Press Ctrl + K and therefore the setting in the preferences dialog box. See the images

    Thank you

  • When I upload an image on mix of adobe photoshop, the image is pixelated... Please help someone!

    When I post a picture on mix of adobe photoshop, the image appears pixelated... very low res. help someone!

    Hi Fredo!

    Mix/Fix can open images at full resolution instead of images of downsizing to 2048px when opening an image compared to the Creative clouds > Lightroom. Please update your application and let me know if you are facing this problem of pixelation always. Also, remember that if you use images downloaded from the internet or other places, they are smaller and so pixelated.

    Thank you!


Maybe you are looking for