Blogs

Enhancing Contrast and Adding Scale Bars to TEM Images Quickly and Easily

NIS Mountain Hero
NIS Favicon
Dr. Brent Wood
March 27, 2025

x min read

microscopic black and white TEM image showing contrast adjustments to TEM images, before & after | NIS

Cryo-TEM images benefit from adjustments to contrast that allow for features of interest to be seen clearly. Finding a suitable contrast level and adding a scale bar are key steps to making an image interpretable and ready for presentation or publication. The following guide will help you through the process.

Filtering, adjusting the contrast, and adding scale bars to an image are straightforward with ImageJ or FIJI, which are freely available. Batch processing options allow for the same adjustments to be made to a large number of images quickly. 

Quick Links to Instructions:

Contrast Adjustment and Mean Filtering

For each report, NIS provides a zipped folder with all of the associated images. Typically these are the full size images in jpeg format. Each downloaded image is a 2D array of pixel values from 0 to 255. The data is displayed as an image with corresponding grey values between black (intensity value of 0) and white (intensity value of 255). 

Upon opening an image you may see that the particles are difficult to distinguish (Figure 1A). We can adjust how the intensity values are displayed so that the particles and features are easier to visualize. Moving the minimum and maximum closer to the range of intensity values in the image and including a small percentage of saturated pixels will allow us to more easily see particle details (Figure 1B). Adjusting the contrast of an image changes how the pixel values are displayed but the underlying data remains the same.

microscopic black and white TEM image showing contrast adjustments to TEM images, before & after | NIS
Figure 1 An image before (A) and after (B) contrast adjustment in ImageJ. The Minimum and Maximum sliders in the B&C window were brought near the range of pixel values shown by the intensity histogram.

Mean filtering is another way the image can be adjusted to help visualize features of interest. While not always necessary, applying a mean filter helps decrease noise in an image. Unlike contrast adjustment, filtering does change the underlying data by assigning the mean value of a neighborhood of pixels to each pixel. The shapes and sizes of neighborhoods at different radii are shown in Figure 2.

black and white image showing TEM neighborhood masks | NIS
Figure 2 Shapes and sizes of neighborhood masks used for mean filtering with pixel radii of 0.5 (A), 1 (B), 2 (C), 3 (D), 5 (E), 8 (F), and 10 (G). Scale bar: 10 pixels.

Applying a Filter and Adjusting Contrast of Individual Images

Applying a mean filter and adjusting the contrast in ImageJ for individual images can be done with the following process:

  1. Open the image with Image J.
  2. From the menu select Process>Filters>Mean.
  3. Set the Radius in the resulting pop-up window and select “OK” (see below for tips on how to set the radius).
  4. From the menu select Image>Adjust>Brightness/Contrast. This will bring up a window called B&C where adjustments can be made (Figure 1).
  5. You can adjust contrast in 3 ways:
    1. Adjust the minimum and maximum sliders closer to the range of the intensity histogram.
    2. Hit “set” in the B&C window and then set the numbers.
    3. Select “Auto” to optimize the brightness and contrast automatically. “Auto” can be selected multiple times until a good level of contrast is found.
  6. Save the image by selecting File>Save As from the menu and choose your preferred format. The adjusted image will be saved as a new file separate from the original. We recommend retaining all original image files in addition to the adjusted image.

At NIS, cryo-TEM images of nanoparticle samples are acquired with one of our four Glacios microscopes. Each Glacios is equipped with either a Falcon 3 or Falcon 4 direct electron detector. Depending on the detector used, slightly different adjustments may be needed. Mean filtering the image with a radius anywhere between 0.5 and 3 in addition to contrast adjustment typically gives good results (Figure 3).

microscopic black and white TEM image showing contrast adjustments to TEM images, before & after | NIS
Figure 3 The same image is shown with no adjustment (A), contrast adjustment only (B), and contrast adjustment plus mean filtering with pixel radii of 0.5 (C), 1 (D), 2, (E), 3 (F), 5 (G), 8 (H), and 10 (I). Contrast adjustment was the same for the images shown in B-H.

Scale Bars

Images downloaded from our client portal do not have scale bars so that you can choose the size and location as needed. To add a scale bar to individual images, you’ll need to set the scale. The scale will depend on the pixel size for the image magnification which can be found in Section 4 of the report or in the online image viewer above the image.

Adding Scale Bars to Individual Images

Follow these steps to add a scale bar to an individual image:

  1. After opening the image, choose Analyze>Set Scale from the menu. In the pop-up window:
    1. Set the “Distance in pixels” field to 1.
    2. Set the “Known distance” field to the correct pixel size for that magnification.
    3. Set the “Unit of length” field to nm.
    4. Select “Global” if you’d like to use this same scale for the next images you open. If the next image will be of a different magnification, leave this box unchecked.
    5. Select "OK"
  2. Optional: Select the line tool from the toolbar and then add a line to the image where you’d like the scale bar to appear. This is useful if you’d like the scale bar to appear next to a particular particle or feature.
  3. Choose Analyze>Tools>Scale Bar from the menu. In the pop-up window:
    1. Adjust the Width of the scale bar, Thickness in pixels, and Font size as preferred.
    2. Color and Location can be adjusted. If you drew the optional line in step 2, select “At Selection” from the “Location” dropdown menu.
    3. Select “OK”.
  4. Save the image in the preferred format. Example: File>Save As>PNG

Adjusting Images and Adding Scale Bars to All Images in a Folder

To save time, instead of adjusting images individually, we can filter, adjust contrast, and add scale bars to all images in a folder. 

  1. Create an output folder where you’d like the adjusted images to be stored.
  2. In ImageJ select Process>Batch>Macro from the menu.
  3. In the pop-up window, set the Input and Output directories and paste the macro into the lower box and select “Process”.

An example macro is shown below that includes mean filtering, contrast adjustment, and the addition of scale bars. Parameters highlighted in yellow can be changed as needed to optimize display of particles, or to specify the size and placement of the scale bar. Parameters highlighted in blue need to be changed to the exact pixel sizes for each magnification (found in section 4 of the report).  

run("Mean...", "radius=1");
run("Enhance Contrast", "saturated=0.4");

filename = getTitle();
if (indexOf(filename, "ex28") >= 0) {
run("Set Scale...", "distance=1 known=0.5 unit=nm");
run("Scale Bar...", "width=500 height=1 thickness=40 font=100 color=White background=None location=[Lower Left] horizontal bold overlay");}

else if (indexOf(filename, "ex73") >= 0) {
run("Set Scale...", "distance=1 known=0.2 unit=nm");
run("Scale Bar...", "width=200 height=1 thickness=40 font=100 color=White background=None location=[Lower Left] horizontal bold overlay");}

else if (indexOf(filename, "ex150") >= 0) {
run("Set Scale...", "distance=1 known=0.1 unit=nm");
run("Scale Bar...", "width=100 height=1 thickness=40 font=100 color=White background=None location=[Lower Left] horizontal bold overlay");}

The example macro will mean filter and enhance the contrast of all images in the input directory including the lower magnifications used for targeting. For the high magnification images, which are typically some combination of 28,000x, 73,000x, and 150,000x images, it will also place a scale bar of the specified length in the lower left corner. 

Figure 4 shows an image series collected of a lipid nanoparticle (LNP) sample before and after processing with the example macro. Filtering, contrast adjustment and scale bar addition allow us to easily see the particles and get an idea of their size. Because all the images collected of this LNP sample were processed together with the macro, we know they were adjusted in exactly the same way.

microscopic black and white TEM image showing contrast adjustments to TEM images, before & after | NIS
Figure 4 28,000x (left) and 73,000x (right) image series before (A) and after (B) running the example macro.

Contact us to start your study today.

Menu Hex HoverMenu HexArrow pointing right to indicate exploring the Nano Imaging Services (NIS) difference.
Prev
Back
Next

Infographic Available for Download

Fill out this form to download the infographic.

Tutorial from expert cryo-EM scientists for editing TEM images, improving contrast, and adding scale bars.

NIS Mountain Hero
No items found.
No items found.