Skip to main content
Participant
February 16, 2008
Question

converting multiple images to layers

  • February 16, 2008
  • 3 replies
  • 658 views
I have multiple sets of images of the same size. Each set consists of two images, the red and green channels from a microscope. There are many sets (20-30) with each set corresponding to a different focal plane. What I'd like to do is combine all the images in a single file, in which the red and green channels go into the red and green chanels of a single layer of the photoshop file, and each set becomes a separate layer. I'm trying to count the total number of a particular type of cell, and this seems to be a better option than making an array and comparing sequential images.

My question is how difficult this would be to do, and whether it is likely that someone could provide an existing script, or whether I would need to look into hiring someone to create the script (the latter may not be possible - I'm in academia, and funds are limited) . I have almost no experience with scripting, and have only made and used custom actions before. There is an existing thread on this forum in which one answer to a similar but simpler question (the goal to to make a multi layer file, but with no need to have the two channels) is that the solution is simple if the images are the same size, but the solution is not described. A second very detailed answer provides what appears to be a fairly complex solution for a situation in which the images are probably not the same size. I might be able to do what I want without having to use the second channel, so if a simple solution exists for just putting many separate images of identical format and size into separate layers of a single photoshop file I would certainly try that first.

I'm using a mac with OS 10.5.1 and cs3.

Thanks,
Paul
This topic has been closed for replies.

3 replies

Participant
February 18, 2008
Hi paul ,
maybe this will help you:
it's just a sample.more details should be added according to you need.
i have run it with photoshp cs3 in windows.
here document[0] mean g channel and document[1] mean r channel

#target photoshop
app.bringToFront();
var strtRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// creat new document
app.documents.add (200,200, 72,"result", NewDocumentMode.RGB);

// copy g channel
app.activeDocument=app.documents[0];
app.documents[0].selection.selectAll();
app.documents[0].selection.copy();
// passt g channel to reuslut
app.activeDocument=app.documents[2];
var aChannelArray = new Array()
aChannelArray[0] = app.documents[2].channels[1];
app.documents[2].activeChannels=aChannelArray;
app.documents[2].paste();

// copy r channel
app.activeDocument=app.documents[1];
app.documents[1].selection.selectAll();
app.documents[1].selection.copy();
// passt r channel to reuslut
app.activeDocument=app.documents[2];
aChannelArray[0] = app.documents[2].channels[0];
app.documents[2].activeChannels=aChannelArray;
app.documents[2].paste();
//active resut rgb channels
aChannelArray[0] = app.documents[2].channels[0];
aChannelArray[1] = app.documents[2].channels[1];
aChannelArray[2] = app.documents[2].channels[2];
app.documents[2].activeChannels=aChannelArray;
Participant
February 18, 2008
hi ,paul

1
i think you should describe you problem more particular.
what format your images(what your described as the red and green channels) are?

2
the work merge two channels to one layer is not complex.

3
and where are you from?
if china, mail to me in chinese:thinkwater@hotmail.com
Participating Frequently
February 17, 2008
I already have a script that does something like this.

Go to this Photoshop scripting web site and Register:

http://ps-scripts.com/bb/login.php

Post your question in the Help Me section.
Then, send me a private message and I'll help you.
It is a better place to post code.

Larry Ligon