Skip to main content

Calculation of Pixels in an Image

Pixels - It is made up of two words - 'Picture' + 'element'. It is the smallest physical point or addressable element in a display image. They are generally represented as the square or dot and can only have a solid color. In some circumstances, they are corresponding to their timing mechanisms and sweep rates and even transparent.

The first step to understanding how to print high-quality photos is to understand pixels per inch (PPI). The pixels on your digital camera or computer screen get converted into dots on the printed photo.

Pixel density or PPI (Pixels per Inch) is not the measurement, they are pieces of information (data). It is the measurement of the resolution of devices in computer display, image scanners or digital camera image. The number of pixels displayed per inch is referred to as resolution.

Calculate PPI: The basic equation is PPI = width(pixels)/ width of image (inches); PPI = height(pixels)/ height of image (inches). So, for example, if you want to print a 4-inch-by-6-inch image, and your pixel count is 800 x 1200, you need to divide 800 (the pixel height) by 4 (the photo height) and then divide 1200 (the pixel width) by 6 (the photo width). The PPI will be 200, providing you with good quality photos. However, if you want to print a larger photo, for example 8-inch-by-10-inch photo, the PPI reduces to 100 for width and 120 for height, giving you lower quality prints.

Have a look to the below image to understand pixels clearly,

Pixels in a image

Lets a image is 2 pixels by 2 pixels with a resolution of 2 pixels per inch. Then, the image would contain 4 pixels.
Memory Cost of Images

Large images consume large memory and make our computers struggle. Memory cost for an image is computed from the image size.

For a 6x4 inch image at 150 dpi, the image size is calculated as:

(6 inches × 150 dpi) × (4 inches × 150 dpi) = 900 × 600 pixels

900 × 600 pixels is 900 × 600 = 540,000 pixels.

The memory cost for this RGB color image is:

900 × 600 × 3 = 1.6 million bytes.

The last "× 3" is for 3 bytes of RGB color information per pixel for 24 bit color (3 RGB values per pixel, one 8-bit byte for each RGB value, which totals 24 bit color).
BITMAP:-
It is the type of memory storage for display images, means the map of bits. The term bitmap implies one bit per pixel, while pixmap is used for images with multiple bits per pixel.

The number of distinct colors that can be represented by a pixel depends on the number of bits per pixel (bpp). A 1 bpp image uses 1-bit for each pixel, so each pixel can be either on or off. Each additional bit doubles the number of colors available, so a 2 bpp image can have 4 colors, and a 3 bpp image can have 8 colors:
  • 1 bpp, 21 = 2 colors (monochrome)
  • 2 bpp, 22 = 4 colors
  • 3 bpp, 23 = 8 colors
  • 8 bpp, 28 = 256 colors
  • 16 bpp, 216 = 65,536 colors ("Highcolor" )
  • 24 bpp, 224 ? 16.8 million colors ("Truecolor")


For color depths of 15 or more bits per pixel, the depth is normally the sum of the bits allocated to each of the red, green, and blue components. Highcolor, usually meaning 16 bpp, normally has five bits for red and blue, and six bits for green, as the human eye is more sensitive to errors in green than in the other two primary colors. For applications involving transparency, the 16 bits may be divided into five bits each of red, green, and blue, with one bit left for transparency. A 24-bit depth allows 8 bits per component. On some systems, 32-bit depth is available: this means that each 24-bit pixel has an extra 8 bits to describe its Opacity (for purposes of combining with another image).

Comments

Popular posts from this blog

Buzzer interface with 8051 microcontroller

Buzzer  is a electronic device that converts the electronic signal into buzzing noise, that is applied to it. It can be used as electronic bell or as quiz buzzer in many applications around us. Here, i world like to discuss the interfacing of a small buzzer with 8051 microcontroller and how different projects can be constructed. Buzzer Interfacing: This project shows the interface with AT89S52 microcontroller to a buzzer. When a push button is pressed, the buzzer will get ON and OFF ( number of times set in the code ) and then stops. Circuit Diagram: - The port P1 of the microcontroller is connected to buzzer. This type of connection is possible, if the current requirements of the buzzer is not more than 20mA. The output is in current source mode so that buzzer will turn ON when the output of the port is logic LOW. Switch is connected to port P3 which remains at logic HIGH by pull up resistor.  Code: #include "REG52.h" #define buz P1 sbit SW=P3^0; long int i; voi

How to Switch OFF Citizen Calculator

You might be confused on seeing no OFF button on your calculator. Actually, these are general calculator available at low cost in the market. They process simple calculations like division, subtraction, Addition, Multiplication. But, how will you OFF that calculator having no option on them. There is always a trick which OFF them. It depends on the company calculator and their series to which they belong. I can tell you about Citizen Calculator CT-500 (as you can see in the image), how can you switch OFF it and can save battery too. If you leave calculator idle for 6-7 minutes, it will goes OFF automatically. My calculator goes OFF in 6.50 minutes from the point of leaving it idle. But, this is not the power saving trick for these types of calculator having not much backup battery. To save the power of your normal calculator, here is the trick to switch OFF it. Press ' /(divide sign)', 'x(multiply sign)', '%(percentage sign)', 'autoreplay option(

Different ways to generate delays in 8051

The delay length in 8051 microcontroller depends on three factors: The crystal frequency the number of clock per machine the C compiler. The original 8051 used 1/12 of the crystal oscillator frequency as one machine cycle. In other words, each machine cycle is equal to 12 clocks period of the crystal frequency connected to X1-X2 pins of 8051. To speed up the 8051, many recent versions of the 8051 have reduced the number of clocks per machine cycle from 12 to four, or even one. The frequency for the timer is always 1/12th the frequency of the crystal attached to the 8051, regardless of the 8051 version. In other words, AT89C51, DS5000, and DS89C4x0 the duration of the time to execute an instruction varies, but they all use 1/12th of the crystal's oscillator frequency for the clock source. 8051 has two different ways to generate time delay using C programming, regardless of 8051 version. The first method is simply using Loop   program function in which Delay() function i