Image Processing with Python#
Course Description#
As computer systems have become faster and more powerful, and cameras and other imaging systems have become commonplace in many areas of life, the need has grown for researchers to be able to process and analyse image data. Considering the large volumes of data that can be involved and the time-consuming nature of manual processing, automating this work as a computer program can be a significant advantage.
This course introduces fundamental concepts in image handling and processing using Python and the scikit-image library. Learners will gain the skills needed to load images into Python, to select, summarise, and modify specific regions of an image, and to identify and extract objects within an image for further analysis. The course also includes an extra episode on multidimensional image data (3D stacks and timelapses) using the Napari image viewer.
Course Objectives#
Load, display, and manipulate digital images with Python using scikit-image and associated libraries.
Understand how digital images are represented and stored (pixels, colour channels, and array structures) and how to process them programmatically.
Apply basic image processing techniques such as blurring, histogram creation, thresholding and connected component analysis to extract meaningful information from images.
Develop reproducible Python workflows that automate common image analysis tasks for research applications.
(if time allows) Analyse and visualise multidimensional data (3D stacks and timelapses) using the Napari image viewer.
Pre-requisite Knowledge#
This course is aimed at researchers who want to learn how to analyse their image data using Python. It assumes you have a very basic working knowledge of Python. Prior attendance at any introductory python course (e.g “Introduction to Python”) or equivalent independent exposure would be ideal. If you are competent in anouther programming, or sripting, language other than Python this will be sufficient.
Sign-up#
To check for upcoming course dates and to register, please visit the Workshop Schedule and Sign-up page.
Installation Guide#
All CfRR courses require attendees to use their own computer/laptop to follow workshop activities and take effective notes.
Required Software#
To complete the activities in this workshop you will need to set up a Python environment with the required packages. We recommend using Miniforge.
Once Miniforge is installed, open a terminal (or Miniforge3 Prompt on Windows) and run the following commands to create and activate a dedicated environment:
mamba create -y -n image-env -c conda-forge python=3.13
mamba activate image-env
mamba install -y -c conda-forge scikit-image ipympl napari pyqt jupyterlab
Note
Windows users
Launch the Miniforge3 Prompt program to run the above commands. Running mamba commands in the standard Command Prompt may return an error.
Launching JupyterLab#
Once your environment is set up, activate it and open JupyterLab:
mamba activate image-env
jupyter lab
After JupyterLab has launched, click the Python 3 button under Notebook in the launcher window to open a new Python 3 notebook.
Course Data and Testing Your Installation#
The example images used in this course are available for download here. Extract the contents into a folder called data inside the directory you will use for this workshop — this name is used throughout the course materials to refer to this folder.
To verify your environment is set up correctly, create a new notebook in your workshop folder and run the following in a cell:
Modifying the path to the data
The test code below assumes your notebook is located in your workshop folder, with the example images in a data subfolder directly inside it. If your folder structure differs, update the file path in the iio.imread() call accordingly.
import imageio.v3 as iio
import matplotlib.pyplot as plt
import skimage as ski
import napari
%matplotlib widget
# load an image (modify path to data directory as needed)
image = iio.imread(uri='./data/colonies-01.tif')
# rotate it by 45 degrees
rotated = ski.transform.rotate(image=image, angle=45)
# display the original image and its rotated version side by side
fig, ax = plt.subplots(1, 2)
ax[0].imshow(image)
ax[1].imshow(rotated)
# open the image in Napari
viewer = napari.Viewer()
viewer.add_image(data=image, name="colonies_01", rgb=True)
<Image layer 'colonies_01' at 0x7ff69d1f3c10>
Upon execution, the above figure should be displayed with an interactive widget, and a Napari Viewer should open in a seperate window displaying the original image.
Self Study Material Link#
The self-study material for this course is available on the Self-study notes: Image Processing with Python page.
Acknowledgements#
This course is based on the Data Carpentry Image Processing with Python Lesson.
If you reuse or adapt this material, please acknowledge the following sources where appropriate:
Data Carpentry Image Processing Lesson: datacarpentry/image-processing
Multidemensional Episode: bham-carpentries/image-processing
Data Carpentry Image Processing Dataset (Figshare): https://figshare.com/articles/dataset/Data_Carpentry_Image_Processing_Data_beta_/19260677
Developers#
Jeremy Pike developed the Multidimensional Data section and is responsible for migrating the original Data Carpentry Image Processing with Python lesson to the CfRR site and for ongoing maintenance and adaptation. The contributors to the original lesson include Jacob Deppen, Kimberly Meechan, David Palmquist, Ulf Schiller, Robert Turner, and Toby Hodges which in turn is built on content originally developed by Mark Meysenburg, Tessa Durham Brooks, Dominik Kutra, Constantin Pape, and Erin Becker.
Course Delivery Content#
There is currently no adíditional content that is used outside of the self-study notes to deliver this course.
License
Licensing in this repository is organised into three categories: instructional material, software, and data.
Instructional Material
The majority of the instructional content is derived primarily from the Data Carpentry Image Processing Lesson and are Copyright (c) Data Carpentry contributors.
The Multidimensional Images Episode was developed seperately at the Univeristy of Birmingham and is Copyright (c) University of Birmingham.
Modifications and new instructional material in this repository are Copyright (c) 2026 University of Exeter.
Unless otherwise stated, all instructional material in this repository is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) license.
You are free to:
Share — copy and redistribute the material in any medium or format
Adapt — remix, transform, and build upon the material for any purpose, even commercially
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
Software
Code examples and software components are derived primarily from the Data Carpentry Image Processing Lesson and is Copyright (c) Data Carpentry contributors.
Code examples and software components for the Multidimensional Images Episode are derived primarily from the Univeristy of Birmingham Data Carpentry Image Processing Lesson and is Copyright (c) University of Birmingham.
Modifications and new instructional material in this repository are Copyright (c) 2026 University of Exeter.
All software in this repository is distributed under the MIT License.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Data
The majority of the example datasets used in this lesson originate from the Data Carpentry Image Processing dataset hosted on Figshare. The dataset is released under the CC0 1.0 Universal Public Domain Dedication (CC0). Copies of the data are included in this repository for convenience; however, the original source is the Figshare record above.