AI, Analytics & Data Science: Towards Analytics Specialist

AI, Analytics & Data Science: Towards Analytics Specialist

Share this post

AI, Analytics & Data Science: Towards Analytics Specialist
AI, Analytics & Data Science: Towards Analytics Specialist
Basic Image Manipulations in Python using scikit-image: Resizing (Scaling), Rotating, and Cropping

Basic Image Manipulations in Python using scikit-image: Resizing (Scaling), Rotating, and Cropping

Dr Nilimesh Halder's avatar
Dr Nilimesh Halder
Aug 23, 2025
∙ Paid
1

Share this post

AI, Analytics & Data Science: Towards Analytics Specialist
AI, Analytics & Data Science: Towards Analytics Specialist
Basic Image Manipulations in Python using scikit-image: Resizing (Scaling), Rotating, and Cropping
1
Share

This article guides you through resizing, rotating, and cropping images in Python using scikit-image, helping you build efficient and high-quality image preprocessing pipelines for computer vision applications.

Article Outline:

  1. Introduction

    • Why image transformations like resizing, rotating, and cropping are foundational in image processing workflows.

    • Advantages of using scikit-image for these operations in Python.

  2. Setting Up the Environment

    • Installing scikit-image and other required packages (NumPy, Matplotlib).

    • Brief explanation of scikit-image’s image representation format (NumPy arrays, channel ordering).

  3. Creating or Loading an Image

    • Loading existing images with skimage.io.imread.

    • Creating a synthetic test image using NumPy for reproducible demonstrations.

  4. Resizing (Scaling) Images

    • Using skimage.transform.resize for absolute and relative resizing.

    • Preserving aspect ratio with calculated dimensions.

    • Choosing the right anti-aliasing and interpolation parameters for different tasks.

  5. Rotating Images

    • Rotating by fixed angles using skimage.transform.rotate.

    • Expanding the image to avoid clipping.

    • Managing fill colors for areas outside the original image.

  6. Cropping Images

    • Cropping using NumPy slicing and scikit-image utilities.

    • Center cropping and bounding box cropping.

    • Important considerations for coordinate selection in multi-channel images.

  7. End-to-End Example Workflow

    • Step-by-step pipeline: load/create → resize → rotate → crop → save/display results.

    • Combining transformations into a reusable function.

  8. Common Pitfalls and How to Avoid Them

    • Shape mismatches after transformations.

    • Image type conversions (float vs uint8).

    • Maintaining quality across sequential operations.

  9. Conclusion and Next Steps

    • Summary of basic scikit-image manipulation techniques.

    • Expanding into more advanced transformations like affine, projective, and perspective warps.

Introduction

Image processing is one of the most fundamental tasks in computer vision, machine learning, and data analysis workflows. Whether you are building a facial recognition system, performing satellite imagery analysis, or preparing training data for a convolutional neural network, the ability to manipulate images efficiently and accurately is critical. Three of the most common geometric transformations applied to images are resizing, rotating, and cropping.

While OpenCV is a popular choice for these operations, Python offers a rich ecosystem of alternatives. One of the most user-friendly yet powerful libraries is scikit-image, which provides a comprehensive suite of image processing functions built on top of NumPy arrays.

In this article, we will explore resizing, rotating, and cropping images using scikit-image. We will use both real-world principles and simulated data to ensure reproducibility. By the end, you will have a deep understanding of how these transformations work, the considerations for maintaining quality, and how to integrate these steps into an end-to-end workflow.


AI, Analytics & Data Science: Towards Analytics Specialist is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.


Keep reading with a 7-day free trial

Subscribe to AI, Analytics & Data Science: Towards Analytics Specialist to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Nilimesh Halder
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share