Tasks for calculating the information volume of a raster graphic image. Determining the number of colors in the palette How to calculate the number of colors in the palette of an image

When choosing flowers, each person thinks about how many flowers should be in the bouquet. Indeed, in addition to the type and shade of plants, their number plays an important role in the bouquet. With the help of special developments, scientists managed to find out that already in the 5th - 6th centuries BC, a certain numerical symbolism was observed. This fact suggests that numbers have a long-proven meaning, so the number of flowers for a gift must be taken seriously.

Even and odd numbers

According to ancient Slavic traditions, an even number of flowers in a bouquet has the meaning of mourning and charges the bouquet with negative energy.

That is why the pair is brought to funerals, graves or monuments. But the residents of the Eastern, European countries and the USA have a completely different point of view on this matter. An even number for them is a symbol of luck, happiness and love.

The happiest number in a bouquet for the Germans is eight, despite the fact that it is even.

In the USA, 12 flowers are most often given to each other together. Residents of Tokyo will react calmly if you give them 2 flowers, the main thing is not 4 - this number is considered a symbol of death for them.

The Japanese, in general, have their own language of plants, and each number has its own meaning. For example, one rose is a sign of attention, three is respect, five is love, seven is passion and adoration, nine is admiration. The Japanese present a bouquet of 9 flowers to their idols, and of 7 to their beloved women. In our country, you can also give an even number of plants if there are more than 15 of them in one set.

The language of flowers

Few people know that the language of flowers determines the number of buds in a bouquet. This language needs to be known and taken into account by the person who makes the gift, so as not to regret their actions in the future. Suddenly, for the recipient, the number of flowers in the bouquet matters.

What the numbers say

An exception to the rule that prohibits presenting an even number of flowers is roses, there may even be two of them.

There is a separate language for these beautiful plants, which determines the meaning for each of their numbers:

How to give a girl a rose

Of course, every woman dreams at least once in her life to receive from her beloved a large number of roses, which will even be difficult to count.

But not always a composition of hundreds of elite plants is more important in terms of love for your chosen one than one beautiful red rose, especially if it is taught correctly.

You should not wrap the flower in a wrapper, and also add extra twigs and plants to it, this will only make it look cheaper.

A rose decorated with a velvet or satin ribbon will look much better. Sometimes you can pack it in a transparent wrapper, but only without excess shine. The same can be said for a bouquet of three buds. If there are more than 7 flowers in the kit, then they must be wrapped and tied with ribbons so that the bouquet looks beautiful and does not crumble.

1In the process of converting a bitmap graphic image, the number of colors decreased from 64 to 8. How many times the volume occupied by

them in memory. Test work on the topic "Computer graphics" Option 2 2Multimedia is A) getting moving images on the display; B) an application program for creating and processing drawings; C) combining high quality images with realistic sound; D) the field of computer science, dealing with the problems of drawing on a computer. 3Choose the correct sequence of stages in the development of computer graphics: a) The emergence of graphic displays; b) Symbolic graphics; c) The advent of plotters; d) The advent of the color printer. A) a, c, d, b; B) b, c, a, d; C) b, a, c, d; D) a, b, d, c. 3. The creation of arbitrary drawings, drawings is engaged in A) scientific graphics; B) design graphics; C) business graphics; D) illustrative graphics. 4. What device of the computer performs the audio sampling process? A) sound card; B) columns; B) headphones; D) processor. 5. A raster image is ... A) a mosaic of very small elements - pixels; B) a combination of primitives; C) a palette of colors. 6. The point of the graphic screen can be colored in one of the colors: red, green, brown, black. How much video memory will be allocated to encode each pixel? A) 4 bits; B) 2 bytes; B) 4 bytes; D) 2 bits; E) 3 bits. 7. The instrument of the GR is: A) Line; B) color; B) sprinkler; D) drawing. 8. The graphic primitive is: A) line; B) an eraser; C) copying; D) color. 9. To obtain a 4-color image for each pixel, it is necessary to allocate A) 1 byte; B) 1 bit; B) 2 bytes; D) 2 bits 10. A discrete signal is ... A) a digital signal; B) the number of measurements made by the device in 1 second; C) the value of a physical quantity continuously changing over time; D) a table with the results of measurements of a physical quantity at fixed times. 11. What is the sampling rate for more accurate sound reproduction? A) 44.1 kHz; B) 11 kHz; B) 22 kHz; D) 8 kHz. 12. What can be attributed to the disadvantages of raster graphics in comparison with vector graphics? A) Large amount of graphic files. B) Photographic image quality. C) Ability to view the image on a graphic display screen. D) Distortion when scaling. 13. What can be attributed to the disadvantages of the LCD monitor? A) light weight; B) dimming when changing the viewing angle; C) absence of e / m radiation; D) small volume. 14Code 1011 is used to encode green. How many colors are in the palette? 15Find the size of the recorded audio quad audio file if it was recorded for 4 minutes, using 16-bit audio coding depth and 32kHz sampling rate. 16 512 bytes of memory were allocated to store a 64 by 64 pixel bitmap. What is the maximum possible number of colors in the image palette? 17 In the process of converting a raster graphic file, the number of colors decreased from 512 to 8. How many times has the information volume of the file decreased?

1) The volume of a sound stereo audio file is 7500 Kb, the sound depth is 32 bit, the duration of this file is 10 seconds. With what sampling rate

is this file recorded?
2) The information volume of an image of 30x30 pixels is equal to 1012.5 bytes. Determine the number of colors in the palette used for this image.

Theory

Calculation of the information volume of a raster graphic image (the amount of information contained in a graphic image) is based on counting the number of pixels in this image and on determining the color depth (information weight of one pixel).

The calculations use the formula V \u003d i * k,

where V is the information volume of the raster graphic image, measured in bytes, kilobytes, megabytes;

k is the number of pixels (dots) in the image, which is determined by the resolution of the information carrier (monitor screen, scanner, printer);

i is the color depth, which is measured in bits per pixel.

Color depth given by the number of bits used to encode the color of the point.

The color depth is related to the number of displayed colors by the formula

N \u003d 2 i, where N is the number of colors in the palette, i is the color depth in bits per pixel.

Examples of

1. The video memory of the computer has a volume of 512Kb, the size of the graphic grid is 640 × 200, there are 8 colors in the palette. How many pages of the screen can fit in the video memory of the computer at the same time?

Decision:

Let's find the number of pixels in the image of one screen page:

k \u003d 640 * 200 \u003d 128000 pixels.

Find i (color depth, i.e. how many bits are required to encode one color) N \u003d 2 i, therefore, 8 \u003d 2 i, i \u003d 3.

Find the amount of video memory required to accommodate one page of the screen. V \u003d i * k (bit), V \u003d 3 * 128000 \u003d 384000 (bit) \u003d 48000 (byte) \u003d 46.875Kb.

Because the amount of video memory of a computer is 512Kb, then you can simultaneously store in the video memory of a computer 512 / 46.875 \u003d 10.923 ≈ 10 whole screen pages.

Answer: 10 full screen pages can be simultaneously stored in the computer video memory

2. As a result of converting a bitmap graphic image, the number of colors decreased from 256 to 16. How did the amount of video memory occupied by the image change?

Decision:

We use the formulas V \u003d i * k and N \u003d 2 i.

N 1 \u003d 2 i1, N 2 \u003d 2 i2, then V 1 \u003d i 1 * k, V 2 \u003d i 2 * k, therefore,

256 \u003d 2 i1, 16 \u003d 2 i2,

i 1 \u003d 8, i 2 \u003d 4,

V 1 \u003d 8 * k, V 2 \u003d 4 * k.

Answer: the volume of the graphic image will be halved.

3. A color image of a standard A4 size (21 × 29.7 cm 2) is scanned. Scanner resolution 1200dpi (dots per inch) and 24-bit color depth. How much information will the resulting graphic file have?

Decision:

1inch \u003d 2.54cm

i \u003d 24 bits per pixel;

Let's convert the image size into inches and find the number of pixels k: k \u003d (21 / 2.54) * (29.7 / 2.54) * 1200 2 (dpi) ≈ 139 210 118 (pixels)

We use the formula V \u003d i * k

V \u003d 139210118 * 24 \u003d 3341042842 (bits) \u003d 417630355 bytes \u003d 407842Kb \u003d 398Mb

Answer: the size of the scanned graphic image is 398 MB

1. Determine the number of colors in the palette at a color depth of 4, 8, 16, 24, 32 bits.

2. In the process of converting a raster graphic image, the number of colors decreased from 65536 to 16. How many times will the information size of the file decrease?

3. 256-color drawing contains 120 bytes of information. How many points does it consist of?

4. Is there enough video memory of 256 KB for the monitor to operate in 640 × 480 mode with a palette of 16 colors?

5. How much video memory is required to store two pages of an image, assuming the display resolution is 640 × 350 pixels and the number of colors used is 16?

6. How much video memory is required to store four pages of an image if the bit depth is 24 and the display resolution is 800 × 600 pixels?

7. The amount of video memory is 2 MB, bit depth is 24, display resolution is 640 × 480. What is the maximum number of pages that can be used under these conditions?

8. Video memory has a capacity that can store a 4-color image 640 × 480. What size image can be stored in the same amount of video memory using a 256 - color palette?

9. For storing a raster image with a size of 1024 × 512, 256 KB of memory were allocated. What is the maximum possible number of colors in the image palette?

Tasks for calculating the volume of audio information

Theory

Sound can have different volume levels. The number of different levels is calculated by the formula N \u003d 2 i, where i is the depth of sound.

Sampling rate - the number of measurements of the input signal level per unit of time (for 1 second).

The size of a digital mono audio file is calculated by the formula A \u003d D * T * i,

where D is the sampling rate;

T - time of sounding or sound recording;

i - register capacity (sound depth).

For a stereo audio file, the size is calculated by the formula A \u003d 2 * D * T * i

Decision:

If you are recording a stereo signal

A \u003d 2 * D * T * i \u003d 44100 * 120 * 16 \u003d 84672000bit \u003d \u003d 10584000bytes \u003d 10335.9375Kb \u003d 10.094MB.

If you record a mono signal A \u003d 5Mb.

Answer:10 MB, 5MB

2. The amount of free memory on the disk - 0.01 GB, the bit depth of the sound card - 16. What is the duration of the sound of a digital audio file recorded with a sampling frequency of 44100 Hz.

Decision:

A \u003d D * T * i

T \u003d 10737418.24 / 44100/2 \u003d 121.74 (sec) \u003d 2.03 (min)

Answer:2.03 minutes

Tasks for independent solution

1. Determine the size (in bytes) of a digital audio file, the playing time of which is 10 seconds at a sampling rate of 22.05 kHz and a resolution of 8 bits. The file is not compressed.

2. The user has a memory of 2.6 MB at his disposal. You need to record a digital audio file with a duration of 1 minute. What should be the sampling rate and bit depth?

3. Free disk space - 0.01 GB, sound card capacity - 16. What is the duration of a digital audio file recorded with a sampling rate of 44100 Hz?

4. One minute of digital audio file recording occupies 1.3 MB on the disk, sound card capacity - 8. How often is the sound recorded?

Between the number of colors specified by the dot of the bitmap and the amount of information that needs to be allocated to store the color of a point, there is a dependence determined by the ratio (R. Hartley's formula):

Where

I- amount of information

Nthe number of colors given to the point.

So, if the number of colors specified for the image point is N \u003d256, then the amount of information required to store it (color depth) in accordance with R. Hartley's formula will be I \u003d 8 bits.

In computers, to display graphic information, various graphic modes of the monitor are used. It should be noted here that in addition to the graphic mode of the monitor, there is also a text mode, in which the monitor screen is conventionally divided into 25 lines of 80 characters per line. These graphics modes are characterized by the resolution of the monitor screen and the color quality (color depth).

To implement each of the graphic modes of the monitor screen, a certain information volume of video memory computer (V), which is determined from the ratio

Where

TO - the number of image points on the monitor screen (K \u003d A · B)

AND - the number of horizontal dots on the monitor screen

AT - the number of vertical dots on the monitor screen

I - the amount of information (color depth), i.e. the number of bits per pixel.

So, if the monitor screen has a resolution of 1024 by 768 pixels and a palette of 65536 colors, then

color depth will be I \u003d log 2 65 538 \u003d 16 bits,

the number of pixels in the image will be K \u003d 1024 x 768 \u003d 786432

The required information volume of video memory in accordance will be equal to V \u003d 786432 16 bits \u003d 12582912 bits \u003d 1572864 bytes \u003d 1536 KB \u003d 1.5 MB.

Files created on the basis of raster graphics assume the storage of data about each individual point in the image. To display raster graphics, no complicated mathematical calculations are required, it is enough to just get data about each point of the image (its coordinates and color) and display them on the computer screen.

Visit almost any photography forum and you will surely stumble upon a discussion regarding the benefits of RAW and JPEG files. One of the reasons some photographers prefer the RAW format is the greater bit depth (color depth) * contained in the file. This allows you to capture photographs of a higher technical quality than what you can get from a JPEG file.

*Bitdepth (bit depth), or Colordepth (color depth, in Russian this definition is often used) - the number of bits used to represent color when encoding one pixel of raster graphics or video. It is often expressed in units of bits per pixel (bpp). Wikipedia

What is color depth?

Computers (and devices that are controlled by embedded computers, such as digital SLR cameras) use a binary number system. Binary numbering consists of two digits - 1 and 0 (as opposed to the decimal numbering system, which includes 10 digits). One digit in the binary system is called a "bit" (English "bit", abbreviated from "binary digit", "binary digit").

An eight-bit number in binary looks like this: 10110001 (equivalent to 177 in decimal). The table below shows how this works.

The maximum possible eight-bit number is 11111111 - or 255 decimal. This is a significant figure for photographers as it appears in many imaging programs as well as older displays.

Digital photography

Each of the millions of pixels in a digital photograph corresponds to an element (also called a “pixel”) on the sensor (sensor array) of a camera. These elements, when hit by light, generate a weak electrical current, which is measured by the camera and recorded in a JPEG or RAW file.

JPEG files

JPEG files record color and luminance information for each pixel in three eight-bit numbers, one number each for the red, green, and blue channels (these color channels are the same as those you see when building a color histogram in Photoshop or your camera).

Each 8-bit channel records color on a scale of 0-255, providing a theoretical maximum of 16,777,216 shades (256 x 256 x 256). The human eye can distinguish between about 10-12 million colors, so this number provides a more than satisfactory amount of information for displaying any object.

This gradient was saved in a 24-bit file (8 bits per channel), which is sufficient for smooth color gradation.

This gradient was saved as a 16-bit file. As you can see, 16 bits is not enough for a soft gradient.

RAW files

RAW files assign more bits to each pixel (most cameras have 12 or 14 bit processors). More bits means more numbers, and therefore more tones per channel.

This does not equate to more colors - JPEG files can already record more colors than the human eye can perceive. But each color is preserved with much finer gradation of tones. In this case, the image is said to have a greater color depth. The table below illustrates how bit depth equates to tint count.

Processing inside the chamber

When you set the camera to record photos in JPEG mode, the camera's internal processor reads the information received from the sensor at the moment you take the photo, processes it according to the parameters set in the camera menu (white balance, contrast, color saturation, etc.). and writes it as an 8-bit JPEG file. All additional information received by the sensor is discarded and lost forever. As a result, you use only 8 bits out of 12 or 14 possible, which the sensor is able to capture.

Post-processing

A RAW file differs from a JPEG file in that it contains all the data captured by the camera's sensor during the exposure period. When you process a RAW file using RAW conversion software, the program performs conversions similar to what the camera's internal processor does when you shoot in JPEG. The difference is that you set the parameters within the used program, and those set in the camera menu are ignored.

The benefit of the extra bit depth of the RAW file becomes apparent in post-processing. A JPEG file is worth using if you are not going to do any post-processing and you just need to set the exposure and all other settings while shooting.

However, in reality, most of us want to make at least a few corrections, if it's even just brightness and contrast. And that's exactly where JPEGs start to give way. With less information per pixel, when you make adjustments to brightness, contrast, or color balance, hues can visually separate.

The result is most evident in areas of gradual and continuous gradation, such as in blue skies. Instead of a soft gradient from light to dark, you will see layering of color stripes. This effect is also known as posterisation. The more you adjust, the more it appears in the image.

With a RAW file, you can make much more dramatic changes in color hue, brightness, and contrast before you see a drop in image quality. Several functions of the RAW converter, such as white balance adjustment and highlight recovery, also allow you to do this.

This photo is taken from a JPEG file. Even at this size, there are streaks in the sky as a result of post-processing.

On closer inspection, the sky shows a posterization effect. Working with a 16-bit TIFF file can eliminate, or at least minimize, the banding effect.

16-bit TIFF files

When you process a RAW file, your software gives you the option to save it as an 8 or 16 bit file. If you are happy with the processing and don't want to make any more changes, you can save it as an 8-bit file. You will not notice any difference between an 8 bit and 16 bit file on your monitor or when you print an image. An exception is when you have a printer that recognizes 16-bit files. In this case, you can get a better result from a 16 bit file.

However, if you plan on doing post-processing in Photoshop, then it is recommended that you save the image as a 16-bit file. In this case, the image from a 12 or 14 bit sensor will be "stretched" to fill a 16 bit file. After that, you can work on it in Photoshop knowing that the extra color depth will help you achieve maximum quality.

Again, when you've finished processing, you can save the file as an 8-bit file. Magazines, book publishers and stocks (and just about any customer buying photography) require 8-bit images. 16 bit files may only be required if you (or someone else) intend to edit the file.

This is the image I took using the RAW + JPEG setting on the EOS 350D. The camera saved two versions of the file - a JPEG processed by the camera's processor and a RAW file containing all the information captured by the camera's 12-bit sensor.

Here you can see a comparison of the upper right corner of the processed JPEG file and the RAW file. Both files were created by the camera with the same exposure setting and the only difference between them is color depth. I was able to "stretch" the "overexposed" details in the RAW file that were not visible in JPEG. If I wanted to work on this image further in Photoshop, I could save it as a 16-bit TIFF file to ensure the best possible image quality during processing.

Why do photographers use JPEG?

The fact that not all professional photographers use RAW all the time doesn't mean anything. Both wedding and sports photographers, for example, often work with the JPEG format.

For wedding photographers who can shoot thousands of wedding photos, this saves time in post-processing.

Sports photographers use JPEG files to be able to send photos to their graphic editors during the event. In both cases, the speed, efficiency, and smaller file size of the JPEG format makes this file type logical.

Color depth on computer screens

Bit depth also refers to the color depth that computer monitors are capable of displaying. It may be hard for a reader using modern displays to believe this, but the computers I used in school could only reproduce 2 colors - white and black. The "must-have" computer of that time was the Commodore 64, capable of reproducing as many as 16 colors. More than 12 units of this computer have been sold, according to information from Wikipedia.


Commodore 64 Computer Photo by Bill Bertram

Surely you won't be able to edit photos on a 16-color machine (64KB of RAM won't do anymore anyway), and the invention of 24-bit displays with realistic color reproduction is one of the things that made digital photography possible. Realistic color displays, like JPEG files, are rendered using three colors (red, green, and blue), each with 256 shades recorded in 8-bit numbers. Most modern monitors use either 24-bit or 32-bit graphics devices with realistic color reproduction.

HDR files

As many of you know, high dynamic range (HDR) images are created by combining multiple versions of the same image captured at different exposure settings. But did you know that the software generates a 32-bit image with over 4 billion tonal values \u200b\u200bper channel per pixel - just a leap from the 256 tones in a JPEG file.

True HDR files cannot be displayed correctly on a computer monitor or printed page. Instead, they are truncated to 8 or 16-bit files using a process called tone-mapping, which preserves the characteristics of the original high dynamic range image, but allows it to be reproduced on devices with a narrow dynamic range.

Conclusion

Pixels and bits are the basic building blocks for digital imaging. If you want to get the best image quality possible on your camera, you need to understand the concept of color depth and the reasons why RAW produces the best image quality.