Everything in the digital ecosystem is stored as numbers and the same is true for every digital image you see.
A Digital Image is simply a grid of numbers where each cell contains information about a single pixel.
Pixel is the smallest unit in an image.
We will dive deep and know about the ” Anatomy of a Digital Image” starting from the macro-level to the micro-level and how the images are stored.
- The dimension of a Digital Image.
- Cell/ Pixel of a Digital Image.
- Breaking A pixel.
- Channels in a Digital Image
- Depth of Image
- Storing Image and Compressing to save data.
Dimension of an Digital Image.
As said digital Image is a grid so it must have a definite width and hight. This width and height represents how many pixels are spread across to make a grid.
For Example: An Image of Dimension 1080×720 has 1080 pixels in width and 720 pixels in height.
Since it is a grid total number of pixels in an image of height Yand width X can be calculated by multiplying X and Y.
1080×720 = 5,097,600 is the total number of pixels in a 1080×720 dimension image.
Cell/ Pixel of an Digital Image.
Each cell of a Image Grid represents a pixel.
But what is the size of a Pixel.?
Pixel Size can be determined by the picture PPI( Pixel Per Inch ) which is a measure of how many pixels are present in an inch of space. PPI determined the smoothness or quality of an image. PPI can be referred to as the density of pixel in an inch space.
Breaking A pixel..
By Analyzing a pixel of a image you can conclude what type of picture it is.
- Is it a colored image, Grayscale, or binary (only balcks and white) image?
- What is the Deapth of the image?
- How many Channels are there in this image?
Each pixel is a single numeric value or an array of numeric values.
For Example., If a pixel has a single value and,
- range 0-1 it is a Black and White (Binary Image). Where 0 represents Black and 1 represent White.
- range(0-255) it is a grayscale image which are said ” Black and white image” in layman terms. Where range 0-255 represent how much dark or light the pixel is
If pixel has multiple values we talk about channels.
Channels in a Digital Image
A channel depicts a single saturated color. For Example- Red or Green or Blue
A 3 channel RGB image will have a pixel with 3 numeric value such as [125,254,485] where each value represent how much each channel is mixed to generate the actual color of the pixel.
The range of numeric value can be 0-255 which represents the saturation of the channel color, the range specifies the depth of color numeric value of 8 bit – ranges(0-255)
Similar to RGB there are different colorspaces such as HSV(Hue, Saturation, Value), CMYK (cyan, magenta, yellow, and key (black)), YUV.
A limited space in a Full color space is called Color Gamut.
Additionally, A transparency channel alpha can be seen in PNG and GIF which controls the transparency of the pixel.
What is the depth of Image?
The depth of image is determined by how many different colors can be produced by mixing channels.
- A 1 bit image can have two numenric value “0” or “1” hence can only show black or white pixels.
- A 8 bit image RBG image will have 3 bit Red channel, 3 bit bit Green, 2 Bit Blue channel.
- A 24 bit image will have 8 bit Red Channel, 8 Bit Blue Channel and 8 Bit Green Channel which inturn gives 2^24 = 16,777,216 color combination.
Depth is also represented as bits/channel. For Example 8bit/Channel is equal to 24 bit image
Storing Image and Compressing to save data.
Saving images efficiently and without losing quality is a complicated task because it deals with a tradeoff between space and quality.
A captured image can be saved by using a lossless compression technique or a lossy compression technique.
Lossless Compression- PNG, TIFF, WEBP,FLIF,HEIF
Lossy Compression- JPEG
However, over the time different versions of the above techniques have developed which can generate lossless or lossy images depending on version of compression.
Next article on how to analyse an image using Python. till then.