imagej MER basics

Ok, with two people now officially requesting help using imagej to process MER images, so it is time for this topic.

I will assume that you have downloaded and installed imagej and that you have downloaded some raw MER image data from somewhere. For example, you can get images from the official MER site or from the Exploratorium site.

To test your imagej install you can use the three images below:

sol 2917 L4:


sol 2917 L5:


sol 2917 L6:


OK, now that you have downloaded the test filter images to a convenient directory ( folder ), start the program imagej.

Click on the menu item File / Open... and navigate to the directory where you saved the test images.

Select the L4 image. It should appear in a separate window. Repeat the File/Open... for the L5 and the L6 images.

You should now have the L4, L5 and L6 images open.

Now click on the menu item Image / Color / Merge Channels...

The color Merge window should have the L4 image file name in the Red: input box and the L5 and L6 files in the Green: and Blue: boxes. The Grey: box should be *None*.

Make sure the Create Composit: check box is checked OFF. ( ie, no checkmark in the box )

If you don't want the source images automatically closed after the color image is created click "on" the Keep Source Images box.

Finally, click the OK button and you should now see a window with this image:


Congratulations! You have just created your first MER false color image!

Now, select the menu item File / Save.

Give the color image a suitable name ( I use the name of the L4 file with "56" added after the "L4". ) and save it somewhere.

In the future I will post the command sequences as imagej macros and you can copy and paste the commands from the comments to a macro and run the macro to process the images.

For example, here is the commands for my macro L234567x2mx-3 that produces three images from all the left pancam filters:


run("Put Behind [tab]");
run("Put Behind [tab]");
run("Put Behind [tab]");
run("Put Behind [tab]");
run("Put Behind [tab]");
run("Images to Stack");
run("Multiply...", "stack value=255.000");
run("Scale...", "x=2 y=2 width=640 height=544 interpolate process create title=Stack-1");
run("Z Project...", "start=1 stop=3 projection=[Min Intensity]");
run("Z Project...", "start=4 stop=4 projection=[Min Intensity]");
run("Z Project...", "start=5 stop=6 projection=[Max Intensity]");
run("Images to Stack");
run("Stack to RGB");
run("Square Root", "stack");
run("Multiply...", "stack value=255.000");
run("Stack to RGB");
run("Duplicate...", "title=L234567x2sqt-1");
run("Multiply...", "value=0.667");
run("Duplicate...", "title=L234567x2-1");
run("Multiply...", "value=0.333");
imageCalculator("Add create", "L234567x2sqt-1","L234567x2-1");
//run("Image Calculator...", "image1=L234567x2sqt-1 operation=Add image2=L234567x2-1 create");


Your homework assignment: Download L2, L5 and L7 filter images and produce a "false color" L257 image.

For extra credit, download R1 and and R2 images and create a "synthetic false color" image using R2 as the Red channel, R1 as the Blue channel and the average of R1 and R2 as the green channel. Hint: Use the menu item Process / Image Calculator to compute the average.

Bummer. Can't edit the first comment of a topic. The smiley face in the sample macro is the text "8 )".

Any imagej processing issues should be discussed on this topic.


Thank you. I will print this out and work on it.

Please give me a bit of time...I'm in Montreal all day tomorrow Friday but will have the chance to read it thoroughly over the drive.

Can't wait to get into it.


dx your a swat lol! Seriously great stuff, Horton is sure to put you through your paces!

Awsome Professor Hort.My first Mars processed image. I converted from tif to jpeg. Love that haze man. I will attempt to post link and start working on extra credit......

Homework L257

Wow Hort, this is way cool..extra credit!!

L257 false color, smoooothed by imageJ

Fred, there is a permission problem on your server for the images - except for reply 7.

The others give a 403 error - Forbidden. You don't have permission to access /uploads/filename on this server.

You may have to flag the photos public.

Or this



L257 because i wanted to...

Lets do that extra credit one more time....

Fred, I deleted the reply 10 with the broken links.

Why don't you create a Flickr account for your image sharing? The basic account is free and the interface is more user friendly - especially the sharing feature.

The download is simple and you have the added benefit of being able to add a long description of the image, make comments, add searchable tags, and link to other images in a variety of ways.

Did I mention it's free?

I hear ya brother. How could you tell I was using free services? lol, You giving out grades now or going to wait untill all the students have turned in thier homework?

Step it up guys this is big....


Here it is merged. Trust this paste works!!!This is all new to me.


try this one.



I went with 'flickr' first without success, then tried 'photobucket' for the final L456. Image a bit small but colors match your work.

I looked at the JPL Rover RAW images site and did not see the same dates you have as only went to 2916...what gives?

Not only that but how do you find and name the images L-this or L-that? Do you require 3 images to make this work? OK, I know about RED GREEN and BLUE but where is that indicated on a B/W JPL image? This is where it gets a bit heavy for me to understand.

Can you describe that process a bit please? Thank you.

When I downloaded the 3 images in your 1st lead post there was not an 'L' number attached to each when I first tried to merge the 3 pics I got some confusing colored images so I added the L4, L5 and L6 to the end of each image as described as such in your lead post so I could find them and place them in the correct placement on the colored merge Channels page. I trust I was able to do that without mucking the merge up!

The merge was successful as imaged in my 15.
It really surprised me at first to see them as one colored image.LOLOL

Thank you. Its a relief to process 1 image so to your macro command lines I have no comment at the moment.


dx, congratulations.

Sorry about the horrid Flickr file names. Flickr generates arbitrary file names for downloaded images. I should have linked the images to either Exploratorium files or the NASA MER site files. Both of them use names with the filter information coded into the image filename.

To share a Flickr file you have to copy the code in the "Share" pulldown button that is on the top left of the picture.

First, click on the "Share" button, then click on the "Grab the HTML/BBCode triangle, then select a convenient size ( I use Medium 500 a lot ), then select HTML for this blog and then select the code ( a single click on the code will select all of the code ) and then copy it ( ctl-c ) and then, finally, paste it ( ctl-v ) in the comment filed of this blog.

Er, the pancams have no Red, Green or Blue filters. What they have is a dog's breakfast of mostly narrow band filters named 1...8. The filters for the left and right pancams are, of course, different. Each filter is explained in this document in the section for character 25 ( Camera Filter ) of the Filename.

The filter map:

( R, G, B ) = ( L4, L5, L6 )

is the closest match to a "real" natural color - with some footnotes.

There are literally dozens of color maps that are commonly used.

Perhaps the most common is the "false color" map of:

( R, G, B ) = ( L2, L5, L7 )

Notice that the sundial color chips look quite different in "false color".

The companion right eye map is the synthetic color map:

( R, G, B ) = ( R3, avg(R1,R2), R1 ) -

with a hue shift. ( don't ask. )

or perhaps something more complicated, like my favorite:

( R, G, B ) = ( max( R3,R4,R5,R6,R7), avg( R1,R2), R1 )

( avg is the average image of two different images. )

Perhaps the most unusual is the "sunset" map:

( R, G, B ) = ( R4, avg( L7,R4), L7 )

In fact, some very strange combinations are used routinely:

( R, G, B ) = ( L2, avg(L2,L6), min(L6, L7))

is used for the miniTES calibration target.

In fact you can be creative and combine the filters any way you want to highlight certain minerals. Winston has played with Ratio color to highlight hematite signatures in the images.

Perhaps now is a good time to stop the lesson and wait for the "aha" moment from the students.


I just got my 'aha' moment...LOLOLOLOLOL!!!and that was a hoot to discover...and it was, believe it or not, the meaning of the 'L' and 'R' cameras as they pertained to RGB.

I did not relate them that easily and it did not connect neuronically [new word], then I realized your favorites>>>[perhaps something more complicated, like my favorite:
( R, G, B ) = ( max( R3,R4,R5,R6,R7), avg( R1,R2), R1 )

What a challenging relief that that part is over!! I remember seeing that JPL site many many years ago -and more than likely you provided it then too- but I was not merging pics at that time it was just enough to see the great difficulty in identifying an image taken from so far away. Good thing we have 26 letters in our alphabet for a 27 number+letters pic from Mars.

If I can ask one Q at this time-I have to get this right as to what I may have garned from reading the JPL site where an example is given at the bottom.

Its mentioned that, 'taken by the left PANCAM through the 535nm (green) filter'. If I extrapolate this data then can I say this:
L5 with 535nm = Green, then L4 with 601nm = Red and L6 with 484nm = Blue? And the same for the corresponding [R] Right camera filters?

Your help is invaluable. Many thanks.


Im still here. Readin' and chewing gum....