Image format introduced in msdn

Source: Internet
Author: User
Tags bmp image

Bitmap is a bit array that specifies the color of each pixel in the pixel matrix. The number of bits dedicated to a single pixel determines the number of colors that can be allocated to the pixel. For example, if four bits are used to present each pixel, a given pixel can be allocated to one of the 16 (2 ^ 4 = 16) colors. The following examples show the number of colors that can be allocated to pixels represented by a given number of digits.

Number of digits per pixel

Number of colors that a pixel can allocate

1

2 ^ 1 = 2

2

2 ^ 2 = 4

4

2 ^ 4 = 16

8

2 ^ 8 = 256

16

2 ^ 16 = 65,536

24

2 ^ 24 = 16,777,216

A disk file storing bitmap usually contains one or more information blocks, which store information such as the number of bits per pixel, the number of shards per line, and the number of rows in the array. Such a file may also contain a color table (sometimes called a palette ). The color table maps the values in the bitmap to a specific color. The following illustration shows an enlarged image and its bitmap and color table. Each pixel is represented by a 4-digit number, so there are 2 ^ 4 = 16 colors in the color table. Each color in the table is represented by a 24-digit number. 8 bits are used in red, 8 bits are used in green, and 8 bits are used in blue. The numbers are displayed in hexadecimal format (base 16): A = 10, B = 11, c = 12, D = 13, E = 14, F = 15.

See the pixels in the 3rd rows and 5th columns of the image. The corresponding number in the bitmap is 1.The color table tells us that 1 represents the color red so the pixel is red. all the entries in the top row of the bitmap are 3.The color table tells us that 3 represents blue, so all the pixels in the top row of the image are blue.

Description

Some bitmaps are stored in the up/down reversed format. The values in the first line of the bitmap correspond to the pixels in the last line of the image.

The bitmap for storing indexes in a color table is called the "palette index bitmap ". Some bitmaps do not require a color table. For example, if a bitmap uses a 24-bit format per pixel, the bitmap can store the color itself (rather than the index) into the color table. The following illustration shows a bitmap that directly stores colors (24 bits/pixel) without using a color table. The illustration also shows the enlarged view of the corresponding image. In the in-place diagram, ffffff indicates white, ff0000 indicates red, 00ff00 indicates green, and 0000ff indicates blue.

Graphic File Format

There are using standard formats for saving bitmaps in Disk Files. GDI + supports the graphics file formats described in the following paragraphs.

BMP

BMP is a standard format used in Windows to store device independence and applications.ProgramIrrelevant image. Each pixel value (1, 4, 8, 15, 24, 32, or 64) of a given BMP file is specified in the file header. A 24-bit BMP file per pixel is common. BMP files are usually not compressed, so it is not suitable for transmission over the Internet.

Interchangeable Image File Format (GIF)

GIF is a common format used to display images on a webpage. GIF files are suitable for pictures with solid color blocks, and images with clear borders between colors. GIF files are compressed, but no information is lost during the compression process. The decompressed image is exactly the same as the original image. A color in a GIF file can be specified as transparent, so that the image will have the background color of any webpage that displays it. A series of GIF images stored in a single file can form an animated GIF. GIF files can be stored at most 8 bits per pixel, so they are only available in 256 colors.

Joint photography expert group (JPEG)

JPEG is a compression solution suitable for natural landscapes (such as scanned photos. Some information will be lost in the compression process, but the loss is invisible to the human eye. JPEG files are stored 24 bits per pixel, so they can display more than 16,000,000 colors. JPEG files do not support transparency or animation.

The compression level in JPEG images can be controlled, but higher compression levels (smaller files) may lead to more information loss. For an image generated at a 20:1 compression ratio, it is difficult for the human eye to distinguish it from the original image. The following illustration shows a BMP image and two JPEG images compressed with this BMP image. The compression ratio of the first JPEG is, and that of the second JPEG is.

JPEG compression is not applicable to Line Graphics, solid color blocks, and clear boundaries. The following illustration shows a BMP image, two JPEG images and one GIF image. JPEG and GIF images are compressed from BMP images. The GIF compression ratio is, the smaller JPEG compression ratio is, and the larger JPEG compression ratio is. Note that GIF images keep clear borders while JPEG images tend to blur borders.

JPEG is a compression scheme, not a file format. "JPEG file interchange format (jfif)" is a file format that is used to store and transmit images that have been compressed according to the JPEG scheme. The jfif file displayed in the Web browser uses the. jpg extension.

Interchangeable image files (EXIF)

EXIF is a file format applicable to photos taken by a digital camera. The exif file contains images compressed according to JPEG specifications. The exif file also contains information about photos (shooting date, shutter speed, exposure time, and so on) and camera information (manufacturer, model, and so on ).

Convertible Network Graphics (PNG)

The PNG format not only retains the advantages of many GIF formats, but also provides functions beyond the GIF format. Like GIF files, PNG files do not lose any information during compression. PNG files can store colors at 8, 24, or 48 bits per pixel, and store grayscale values at 1, 2, 4, 8, or 16 bits per pixel. In contrast, GIF files can only use 1, 2, 4, or 8 bits per pixel. PNG files can also store an Alpha value for each pixel, which specifies the degree to which the pixel color is mixed with the background color.

PNG is better than GIF in that it can gradually display an image (that is, the displayed image will become more and more complete when the image is transmitted over the network ). PNG files can contain Grayscale Correction and color correction information so that images can be accurately displayed on a variety of display devices.

Label Image File Format (TIFF)

Tiff is a flexible and scalable format that is supported by a variety of platforms and image processing applications. TIFF files can store images at any position per pixel, and can be compressed in a variety of ways.Algorithm. A single multi-page TIFF file can store several images. You can store image-related information (scanner manufacturer, host, compression type, print direction, and pixel-per-pixel sampling) in files and sort the information using tags. You can extend the TIFF format by approving and adding new tags as needed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.