• Complain

Martin McBride - Image Processing in Python

Here you can read online Martin McBride - Image Processing in Python full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2021, publisher: leanpub.com, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Martin McBride Image Processing in Python
  • Book:
    Image Processing in Python
  • Author:
  • Publisher:
    leanpub.com
  • Genre:
  • Year:
    2021
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

Image Processing in Python: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Image Processing in Python" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Martin McBride: author's other books


Who wrote Image Processing in Python? Find out the surname, the name of the author of the book and a list of all author's works by series.

Image Processing in Python — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Image Processing in Python" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Image Processing in Python Processing raster images with the Pillow library - photo 1
Image Processing in Python
Processing raster images with the Pillow library
Martin McBride

This book is for sale at http://leanpub.com/imageprocessinginpython

This version was published on 2021-08-22

This is a Leanpub book Leanpub empowers authors and publishers with - photo 2

* * * * *

This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and many iterations to get reader feedback, pivot until you have the right book and build traction once you do.

* * * * *

2021 Martin McBride
Preface

This book provides an introduction to the basics of image processing in Python, using the Pillow imaging library. After reading this book you should be able to create Python programs to read, write and manipulate images.

Who is this book for?

This book is aimed at anyone wishing to learn about image processing in Python. It doesnt require any prior knowledge of image processing, but it will also be useful if you already have experience working with image data and would like to learn the specifics of the Pillow library.

It will be assumed that you have a basic working knowledge of Python, but all examples are fully explained and dont use any advanced language features.

About the author

Martin McBride is a software developer, specialising in computer graphics, sound, and mathematical programming. He has been writing code since the 1980s in a wide variety of languages from assembler through to C++, Java and Python. He writes for PythonInformer.com and is the author of several books on Python. He is interested in generative art and works on the generativepy open source project.

Keep in touch

If you have any comments or questions you can get in touch by any of the following methods:

  • Joining the Python Informer forum at http://pythoninformer.boards.net/.
  • Signing up for the Python Informer newsletter at pythoninformer.com
  • Following @pythoninformer on Twitter.
  • Contacting me directly by email (info@axlesoft.com).
Introduction

This book is about bitmap imaging in Python. It is divided into two sections:

  • Bitmap images - introduces some important concepts of bitmap imaging, including colour representation, pixel data models, image compression, file formats and metadata.
  • Pillow library - a detailed tutorial on the Python Pillow imaging library, one of the most popular Python imaging libraries.

There is also a Reference section, containing some useful information that you will probably need to refer too, all gathered in one place.

Versions

This book uses Pillow version 8.2.0 and Python version 3.9.

The examples will work with older versions (Pillow version 5 or later, Python version 3.6 or later).

There is a good chance the examples will also work with newer versions.

Example sources on github

You can find example images and source files on github, at https://github.com/martinmcbride/python-imaging-book-examples

I Bitmap images
Introduction to bitmap imaging

This part of the book covers bitmap imaging.

This chapter will cover the basics of what a bitmap image is. Later chapters will cover:

  • How computers represent colour.
  • Colour models.
  • Colour resolution.
  • How image data is stored in memory.
  • Transparency.
  • Image compression.
  • Image file formats.
  • Colour management.
1.1 What is a bitmap image?

You most likely already know what a bitmap image is. Almost any image you see on the web will be a bitmap image, and you have probably used your smartphone or digital camera to capture photographs as bitmap images.

You might be more familiar with alternative names - raster image, or pixel image. They mean the same thing as bitmap image. They are sometimes also called JPEG images or PNG images, named after specific image file formats.

You probably also know that a bitmap is made up of pixels - they can be thought of as tiny coloured squares that make up the image. They are normally too small to see but become visible if you zoom in too far and the image becomes pixelated.

This chapter presents an overview of the characteristics of bitmap images, in preparation for the remaining part of this section that looks at bitmap images in detail.

1.2 Spatial sampling

A real-world scene has an almost infinite amount of detail. If you look out at, for example, a boat by a lakeside, it goes beyond the detail your eye can see. You could walk up to the boat and look at it in virtually unlimited detail.

A bitmap image has a finite amount of detail. If you took a digital photograph of the boat, the camera would convert it into an array of pixels. Each pixel represents a small part of the image.

If the pixels are very small together, we cant distinguish the individual, and the image looks similar to the actual scene. If they are larger, we see the image as a set of pixels rather than a natural image, as this illustration shows:

In practical terms, at a viewing distance of 40 cm, the eye can resolve objects that are about 0.1 mm apart. So for example, imagine a sheet of paper with two thin lines drawn 0.1 mm apart. If you held the paper 40 cm in from of your face, assuming you have normal eyesight, you might just about be able to see that there were two separate lines. Any further away and they would just look like a single line.

This means that if you wanted to print an image on a page so that the eye couldnt see the individual pixels, you should aim for a pixel resolution of 10 pixels per mm (about 250 pixels per inch) or better. So for a printed photograph or 15 cm by 10 cm, you would want an image of at least 1500 by 1000 pixels. That would be a 1.5 megapixel (MP) image.

In reality, you would probably want a higher resolution than that:

  • To allow you to print larger photographs.
  • To allow you to crop a photograph to show just the subject.

Most modern digital cameras support image sizes of 6 MP or higher.

However, very large pixel sizes are not always as useful as they might seem:

  • For printing very large images, such as posters, they are normally viewed from further back than 40 cm, so there is no need to have 0.1 mm spatial resolution.
  • At very high resolutions, factors such as camera shake will blur the image, so there is little point in taking a very high-resolution photograph without a very solid tripod.
1.3 Colour representation

Each pixel in a bitmap image has a specific colour. There are various ways we might represent a colour in an image.

The most common way to represent a colour is as three separate components, the amount of red, green, and blue light that make up the colour. As we will see, this is based on the way the human eyes perceives colour. However, we sometimes use alternate methods, including:

  • CMYK - used to represent colours for printing.
  • HSL - used in art and design as an intuitive way to select related colours.
  • Perceptual colour spaces such as CieLAB used to create very accurate colours.

An important consideration is how precisely we need to represent each colour in an image. As rough a rule of thumb, we can detect variations in colour of about 1%. Most modern systems use 8 bits per channel (for example, three integers between 0 and 255 to store the red, green, and blue values). This gives a precision of better than 0.5%, which is adequate for most uses.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Image Processing in Python»

Look at similar books to Image Processing in Python. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Image Processing in Python»

Discussion, reviews of the book Image Processing in Python and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.