What's New
Site Map

Bits N Bobs
Food And Drink

Recipe Collections
Recipe A Week 2013
Recipe A Week 2010
A-Z of Regional Cakes
Alphabet of Nations

Selected Entries
Pinhole Photography
Keeping Quail
A different recipe each week
Friends websites
Oven Temperatures and Measuring Cups

Most popular stories
A Hamster's Home is his C...
Hamster Peanuts
Simple HDR photography wi...
Halloween Animal Beds
A Tangfastic Mess
Hamster Baby Update
Decaffeinated Coffee
Garden Fountain
Pizza, Hamsters and Ballo...
More Squirrel Photos
Not Quite HDR photography

RSS Feeds:
RSS Feed Entire Site.
RSS Feed Diary only.

Powered by Blosxom

Pinhole Photography Ring
pinhole webring logo
powered by RingSurf
Next | Previous
Random Site | List Sites

Simple HDR photography with ImageJ

Story location: Home / photography /

This follows from my first attempt at 'HDR-style' photography with ImageJ. I have abandoned my old approach, which used ImageJ macros, and have developed a couple of plugins which are easier to use.

Description of Plugins

The first plugin is a version of Unsharp Masking, which subtracts a blurred version of an image from the original. This can improve local contrast and bring out detail in flat areas.

The second plugin is a modification of the CLAHE (Contrast Limited Adaptive Histogram Equalization) plugin. This performs local histogram equalization on sections of the image. This usually gives better results than the simple Unsharp Mask, but is a lot slower.


  1. Download and install ImageJ following the instructions at http://rsbweb.nih.gov/ij/download.html.
  2. Download the file hdr_.jar. Copy this file into the ImageJ/plugins/ directory.
  3. Start ImageJ, or select 'Help->Update Menus' if ImageJ is already running.


The plugins can be found in the 'Plugins' menu, in a 'HDR' submenu.

Both plugins expect a 3-channel TIFF file and can accept 16bit or floating point files. If your camera can save 16 bit RAW files then it may be possible to convert these into TIFF files - check the camera's documentation or any software supplied with it.

After loading the image, select the appropriate plugin from the menu. If 'preview' is selected, a small preview window opens which gives a approximate version of the result. At the moment, this window cannot be moved, so if it appears under the dialogue box, that window will need moving out of the way.

After clicking on 'OK', the plugins process the image and return a processed colour image, and a 3-channel floating point image which holds the full dynamic range and could be used for any additional processing steps.

Unsharp Mask

This plugin has the following options:

  1. Strength (1-100). Higher values give a stronger effect.
  2. Blur Radius (1-100). This is the amount of blurring applied to the image which is subtracted from the original.
  3. Saturated (1-100). After applying the Unsharp Mask, the contrast is adjusted so that a small number of pixels are saturated (set to either 0 or 255). The percentage of pixels is the selected value/10.

Local Contrast

Two options are available:

  1. Block Size (in pixels). This is the size of the area used to calculate the histogram. The best value depends on the properties of the image.
  2. Maximum Slope. The CLAHE method increases contrast but will use this parameter to set a maximum contrast. The actual slope is value/10. Higher values give a stronger effect but can also increase noise in areas of flat colour.

Examples of Use

Original image - photograph of Ironbridge in Shropshire, taken on a overcast day with very poor light. The camera was set to its lowest contrast setting to capture the full dynamic range, otherwise the sky would have been burnt out.

Unsharp Mask
After applying an Unsharp Mask. The whole image has been lightened, with the darker areas being lightened more.

After applying the CLAHE method. The effect is much stronger than the Unsharp Mask, with more detail visible in the sky and better colour in the ground.

permanent link

mark wrote at 2010-04-27 23:53:

quite a simple and useful tool! Can this apply to integrate the different exposure photos together?

Mike wrote at 2010-04-28 21:37:

Hi Mark.

I'm glad you find it useful. If you have a set of bracketed exposures then you can use the 'Add Bracketed Images' command - I have updated the hdr_.jar file to include it. It just adds the images together so it doesn't work very well if there are any bright highlights.

Stephan Saalfeld wrote at 2010-08-17 08:48:

Check out the fast version of the CLAHE plugin:


Nemo wrote at 2011-07-21 06:22:

I've tried your HDR local contrast plugin on a variety of "dificult" images. I'm impressed, but the results have been mixed. In some low-contrast images (e.g. with cloudy skies -- as in your example above) it works very well. But silhouettes tend to acquire a bright, diffuse halo, and monochromatic areas (e.g. clear blue sky) develop patchy noise no matter what I set the numbers to. Do you have any tips for these situations? And, are you planning to develop the idea further?

Mike wrote at 2011-07-21 09:05:

Hi Nemo,

I'm glad you have found the plugin useful but I haven't done any further development of it recently. I have also found that some high contrast edges look strange. What I have been doing recently is using iPhoto on the mac to adjust the highlight and shadow detail of 16-bit RAW photos to bring in a bit more detail. The results aren't quite as strong as using the HDR plugin but they are better than 'straight' photos.

Kirill wrote at 2012-08-16 09:06:

Thanks, nice plugins!

Brian wrote at 2014-04-19 21:38:

I don't understand how you take 3 pictures and combine them into 1 HDR photo. I see the 'add bracketed images' but I'm not sure what that does. It doesn't bring up a dialog to ask where the other bracketed images are, all it does it turn my current image into a black and white image.

Mike wrote at 2014-04-19 22:32:


the 'add bracketed images' will simply add together whichever images are loaded into ImageJ at the time. It returns a 3-channel 16 bit image. Use the 'TIFF16 to RGB8' command to turn them into a standard colour picture.

To be honest, these plugins are a bit basic and I haven't made any changes to them for years. Since I wrote them, more HDR software has been released, so my plugins aren't really needed any more.

Lucas wrote at 2017-01-31 10:20:


When I'm running the plugin trough macro using:

run("Unsharp Mask", "strength=100 blur=255 saturated=100");

I get only a preview of the processed file and not the full size :( Do you know how I can fix that? Or how I can implement the plugin in a macro?

Thank you very much in advance,


Mike Downey wrote at 2017-01-31 22:51:

Hi Lucas,

I don't think I had tried the plugin from a macro. I hadn't realised that it didn't work properly when run that way. I have probably got the source code somewhere, if I can find it, I might make it availablefor anyone to look at. To be honest.