C # two important classes in image processing

Source: Internet
Author: User
Bitmap class

Bitmap is an object used to process images defined by pixel data.

Its Inheritance level: system. Object-> system. externalbyrefobject-> system. Drawing. Image-> system. Drawing. Bitmap

Namespace: system. Drawing

Assembly: system. Drawing (in system. Drawing. dll)

Main attributes of this class

Height: obtains the image height (in pixels );

Width: obtains the image width in pixels );

Palette: gets or sets the image palette;

Pixelformat: Obtain the pixel format of the image.

The primary methods of this class are lockbits and unlockbits, which respectively lock and unlock bitmap pixels in the system memory and are used in pairs. Each time lockbits is called, unlockbits should be called once.

Public bitmapdata lockbits (rectangle rect, imagelockmode flags, pixelformat format); Public void unlockbits (bitmapdata );

Bitmapdata class

The bitmapdata object specifies the bitmap attribute.

Height: the height of the locked bitmap;

Width: the width of the locked bitmap;

Pixelformat: the actual data pixel format;

Scan0: The Byte address of the locked array. If the entire image is locked, it is the first byte address of the image;

Stride: The stride, also called scan width.

As shown in, the array width is not necessarily equal to the width of the image pixel array, and some unused areas exist. To improve efficiency, the number of bytes in each row must be a multiple of 4.

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.