One of the most frequent questions that I get asked is how to add a scale bar to an image. While it’s good that people are adding scale bars to images for presentations, posters and papers, it’s not always done terribly well. In this post, we’ll look at two ways to do it and why you would favour one or the other
Scale bars represent the relationship between the size of physical objects and the size those objects appear in an image. Most microscope file formats will store the calibration data (IE the dimensions of an image pixel in physical units) upon acquisition, however the onus is on the end user to make sure that it’s correct.
When you open an image in Fiji, you can tell immediately if the image is calibrated by looking at the Infobar (see below, above the image, below the window):
If an image has calibration information (above, right), the calibrated dimensions of an image are displayed with the units (65.02μm) followed by the pixel dimensions (256×256).
You can also find the calibration info by opening up the Properties of the Image [Image > Properties], where you’ll get a dialog not too dissimilar to this:
If your image is uncalibrated, enter the calibration information here. You can pick any Unit you want, for example the much under-used (and definitely not made up) micro-dolphin. If you’re less outgoing and want to stick to micrometres, “um” or “micron” are acceptable and will automatically be converted into “μm”.
NOTE: I’m not going to deal with calculating the calibration information here, but it will probably be the topic of another post.
Adding Scale Bars to an Image
With a calibrated image, adding a scale bar couldn’t be simpler. Run the [Analyze > Tools > Scale bar] command to be presented with the following (fairly self-explanatory) dialog:
Hit OK, and you can now copy the image into a slideshow presentation or report. What you probably shouldn’t do, is use it in a figure for publication or on a poster. Here’s why…
Why this may not be a great idea
Generally, I’m of the opinion that permanent manipulations to an image should be avoided. Keeping the original data files (which you should ALWAYS do) negates this concern, but I can still come up with three other good reasons why this is not a great idea:
- If you need to change anything about the scale bar (size, position or colour, being the obvious examples), you have to start again fresh from the original images.
- If you want to go back and analyse the intensity of the images, your images will have added data pixels (the scale bars are “drawn” onto the image).
- If you draw a scale bar onto an image, then resize the image later, the scale bar will also be resized. This is technically what you want (so it still represents the right size), however the quality of the scale bar will be degraded if you scale too much (for example in a multi-pane figure in a report or publication). The example below was scaled to just 75% of the original size and already shows some degradation (this is more of a problem with skinny scale bars and text).
So what’s the alternative? I was hoping you’d ask…
Image data are examples of raster graphics. The problem, as we have seen, is that raster graphics do not adapt to scaling. Vector graphics on the other hand, are a mathematical description of a graphic. As such, they’re infinitely scalable with no loss of sharpness.
The idea here is to add the scale bar after you import your image into your software of choice. Being a huge fan of Open Source (free-like-speech and free-like-beer) software, I use Inkscape to make publication-grade figures, posters, website graphics and much more.
With your images in Inkscape, use the pen tool to draw (what will become) your scale bar. Hold CTRL to make it a straight line. Any size and colour will do.
Now we have to calculate the length for the finished scale bar. Inkscape can use almost any units (they haven’t responded to my letters about the inclusion of micro-dolphins) but defaults to pixels (see the toolbar in the image above). In this case, if the scale bar were 256 pixels in length (the same size as the image – see above) we know that it would represent 65.02μm (see the first image of this post). You can calculate the length that the bar needs to be using:
So for the above example, if we wanted a 10um scale bar we would make our scale bar:
So all that is left to do is to make the scale bar 40 pixels in length (which can also be done on the toolbar). Finally you can adjust the thickness and colour of the line in the “Fill and Stroke” dialog.
At this point you may want to group the two objects so that they scale together should you to resize the image.
NOTE: For several reasons, PowerPoint is not a good choice of software when it comes to making figures and posters that contain images. If you do use PowerPoint however, the method is almost identical. The size information can be found in the “Image Properties” menu. My version of PowerPoint is set to use centimetres, so the equation just becomes: