How do I change colours?#
What will I learn?
How to adjust the brightness & contrast
How to change fluorescence channel colours
How to separate stains in brightfield images
We started the first chapter with 3 core facts:
Images are composed of pixels
Pixels have numeric values
Colours are used to display pixels based on those numeric values
While the numbers are what matters for analysis, the colours are still very useful for our visual interpretation.
This chapter explores how we can change what we see – without necessarily changing our data.
How to adjust the brightness and contrast#
Fig. 11 Why is he so nervous?#
What to do
Open the image
spooked.png.Choose Other as the image type
Open QuPath Brightness & Contrast dialog using any of these (equivalent) methods
Click on the toolbar button

Use the shortcut Shift+C
Move the Channel min, Channel max and Gamma sliders.
Press the Reset button to return everything to normal.
is extremely useful – that’s why there are 3 ways to open it.
Sometimes, you need to change the brightness and contrast because important details aren’t visible otherwise.
However, it’s important to be cautious and make sure you know what’s happening. Specifically, you need to know whether changing the sliders is changing your data, or only how it is displayed.
Question
Move the Channel min and Channel max sliders in QuPath’s Brightness & Contrast window.
Do these sliders change the numeric values of the pixels, or only the colours used to display pixels in the viewer?
How do you know?
Question
What is making the guy in spooked.png look so nervous?
Go easy on gamma!
It’s normal to have to adjust the Channel min and Channel max sliders for fluorescence images. Changing the Gamma is less common – if you use a gamma that isn’t 1.0, you should mention this in any figure legends.
For more information and best practice guidelines, check out
Schmied, C., Nelson, M.S., Avilov, S. et al. Community-developed checklists for publishing images and image analyses. Nat Methods 21, 170–181 (2024). https://doi.org/10.1038/s41592-023-01987-9
How to change fluorescence channel colours#
Toggle channels on and off#
Fig. 12 Set fluorescence image type#
What to do
Open
LuCa-7color_[13860,52919]_1x1.tifChoose Fluorescence as the image type
Open the brightness and contrast dialog

Use the checkboxes to turn channels on and off
Type a number (e.g. 1, 2, 3) and see what happens
In images with multiple channels, it’s possible to toggle individual channels on and off using the brightness & contrast dialog
.
However, you can also quickly change turn channels on or off by simply typing the number of the channel using your keyboard – and this works even if the brightness & contrast dialog isn’t open.
Change the brightness & contrast for each channel#
Fig. 13 Brightness and contrast window of a multiplex image#
What to do
Select a channel by clicking on it (it’ll be highlighted in blue)
Make sure the channel’s Show checkbox is turned on
Explore how the Channel min and Channel max sliders are influenced by which channel is selected
Press the Auto and Reset buttons
When a channel is selected, moving the Channel min and Channel max sliders should adjust the brightness and contrast only for that channel.
Pressing Auto asks QuPath to try to set the sliders automatically to values that (hopefully) are sensible. Pressing Reset should set the Channel min to the lowest pixel value and Channel max to the highest pixel value[1]. This behaviour is similar to the equivalent buttons in ImageJ.
Puzzle
Open the message.tif image.
Using the settings in the brightness & contrast dialog, see if you can find anything unusual in the image.
Changing channel names & colours#
What to do
Double-click on a channel, e.g. CD8 (Opal 540)
Enter a new channel name.
Select a new channel colour.
Click Apply
also makes it possible for you to change channel names and colours.
Both can be changed by double-clicking. Alternatively, you can click directly on the small colour square to change the channel colour only.
Question
What do the Show grayscale and Invert background checkboxes do?
How to separate stains in brightfield images#
Digital stain separation with colour deconvolution#
What to do
Open
CMU-1.svs.Choose Brightfield (H & E) as the image type
Open the brightness and contrast dialog

Click on Hematoxylin to view a stain-separated image
See how the numbers in the bottom right change when you move the cursor over the image
Setting the image type to Brightfield H & E gave QuPath the information it needed to digitally separate the stains using a process called colour deconvolution[2].
This is based on a default estimate of the stain colours: it won’t be perfect, but it’s often good enough to be useful.
After selecting Hematoxylin, when you move your cursor over the image, you no longer see the original pixel values. Rather, you see the colour deconvolved values that are related to the staining that is present.
Importantly, QuPath’s approach to colour deconvolution doesn’t permanently change the pixel values. You can easily switch back to the original image through the brightness/contrast dialog. The separation is really a visualization trick to help us understand the image a bit better.
Fig. 14 Digital stain separation using the brightness/contrast dialog.#
Type matters#
What to do
Go back to the Image tab double click Image type.
Change the type to Brightfield (H-DAB).
See how the channels available in the brightness/contrast dialog change
Repeat the process, setting the image to have different types.
Setting the image type in QuPath changes the channels that are available in the brightness and contrast dialog.
What’s more, not all channels are quite the same.
With a fluorescence image (e.g. LuCa-7color_[13860,52919]_1x1.tif), the channels that we could see where those that were stored in the original file.
But for the brightfield CMU-1.svs, the channels QuPath shows are calculated digitally – and depend upon the image type.
This is why it’s important to get into the habit of setting the type of an image in QuPath: it influences how the software will behave. It doesn’t matter for every command, but it does matter for some important ones – including cell detection.