In VC + + MFC programming, we often use the picture control to display images. Below is a brief summary of several different ways of showing:(the instance can be downloaded in my CSDN resource: http://download.csdn.net/detail/margin1988/8341525)The first, the resource bitmap way to display BMP pictureIf you want to display a BMP bitmap, you can use the resource bitmap method, the following steps:(1) Copy th
A few days ago encountered the need to scale BMP bitmaps,
Call API functions, although it can achieve bitmap scaling, but the effect of amplification is good, narrowing will cause distortion, the image has a flower point, it is difficult to accept
, because I used to learn easy language, easy language has a piece of code, BMP image scaling effect is very good,
Yesterday, the time to translate it into C +
The C language converts the color BMP bitmap into a Binary Map, bmp bitmap
CTF does not have a systematic understanding of the hidden Question of the image. First, we will summarize the composition of the BMP image and deepen our understanding by converting the color image into a binary image.
Only the format and code implementation of Bitmap binary files are wri
Many images require a 16-bit BMP format during Android porting. Therefore, we have studied how to convert from 24-bit to 16-bit for your reference.
Step 1: view the properties of the BMP image, as shown in. It is 24-bit
Step 2: use Photoshop to open the image, and then click File --> Save
Step 3: select the BMP format in the pop-up option box and click Save
S
Use ffmpeg to encode the BMP image as a x264 video file and save the H264 video as a BMP image,The ffmpeg open-source library encodes bmp images into x264 files and decodes and saves the encoded H264 files as BMP files. Based on the blog code, you can build a test environment in vs2010. Resource download code:
# Define
The resource ". bmp", ...bmp cannot be found in the class...
A program written in WinForm adds a bmp image to the project, and then
Public void SetSubType (int SubType){M_subType = SubType;Switch (m_subType){Case 1: base. m_bitmap = new Bitmap (GetType (), "cmdSelectLayer.bmp"); break;Case 2: base. m_bitmap = new Bitmap (GetType (), "effecnotselectlayer.bmp");
Remote Control of writing screen transmission MFC realize screen transmission BMP data display BMP image:
I:
First of all to understand the structure of BMP image details please see I reprint an article http://blog.csdn.net/hnust_xiehonghao/article/details/37656281
Ii. Controlled Code
Note that the following code should be put into a thread because the while endl
;} bitmapfileheader;bftype--is a bitmap file type, must be BM, converted to hexadecimal code is 0x4d42 (small end of the convention, about big and small end of the concept refer to the later days of the article) the size of the bfsize--bitmap file, in bytes, Represents the size of the entire BMP file, including 2 header segments and bitmap data areas, calculated as follows:sizeof(Bitmapfileheader) +sizeof(Bitmapinfoheader) + (biwidth* bibitcount+ to)/
) {// open the specified image file * fp = fopen (BMP name, "rb") in binary read mode; If (FP = 0) return 0; // skip the bitmap file header structure bitmapfileheaderfseek (FP, sizeof (bitmapfileheader), 0); // define the bitmap information header structure variable and read the bitmap information header into the memory, in the variable head, bitmapinfoheader head; fread ( head, sizeof (bitmapinfoheader), 1, FP ); // obtain information such as image w
= file. bfreserved2;Long bfoffbits = file. bfoffbits;// Define the bitmap information header structure variable, read the bitmap information header into the memory, and store it in the variable headBitmapinfoheader head;Fread ( head, sizeof (bitmapinfoheader), 1, FP );BMP width = head. biwidth;Bmpheight = head. biheight;Bibitcount = head. bibitcount;// Define the variable to calculate the number of bytes o
much larger than the compressed image file format of the same image. For example, a 800x600 24-bit occupies almost 1.4MB of space. Therefore, they are usually not suitable for transmission on the Internet or other medium with low or limited capacity. Depending on the color depth, a pixel on the image can be represented by one or more bytes, which is determined by N/8 (n is bit depth and 1 bytes contains 8 data bits). Pixel-based ASCII values, such as the picture browser,
structure from the file with the specified file nameBitmapfileheaderIs the size of the data block, and then the file header flag determines whether the file isBMPBitmap fileBitmapfileheaderMediumBfsizeCompare the size of the saved file with the actual size of the file to determine whether the file is damaged.BitmapfileheaderMediumBfoffbitsAndBitmapfileheaderThe structure size is reduced to calculate the total size of the MAP information header and th
An example Analysisthe properties of the sample picture;OriginalThe red line is the end of the file header;The second red line is the end of the bitmap information header;Use Windows Paint to take the color of the point (2,2) pixels; the paint is counted from 0, that is, the pixels in row 3 of line 3rd;Search for 16 binary bc542f;11 searches;The data are searched by the back; it seems that the bitmap data is stored upside down;Control the above picture;File headerHexadecimal value Description4D:
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Define VGA256 0x13 // 320*200 256 color display mode
# Define TEXT_MODE 0x03 // 80x25 16-color text mode
# Define SCREEN_HEIGHT 200 // Image Height, in pixels
# Define SCREEN_WIDTH 320 // image width, in pixels
# Define PALETTE_MASK 0x3c6 // mask register port in the palette. Put 0xff to access your desired register through the color palette index registers 0x3c7 and 0x3c8
# Define PALETTE_REGISTER_RD 0x3c7 // rea
;
The third part is the color palette information or mask. If it is an 8-Bit Bitmap, the color palette is stored. If it is a 16-Bit Bitmap, the 32-Bit Bitmap stores the RGB color mask, which is stored in DWORD size.
The last part is the data entity of the bitmap.
The above file information can be found in any article on the bmp file structure, so this article is just a little bit.
2. 4-byte Problems
Read data.
[From network] The format of the BMP file storage structure can be defined in wingdi. h file in windows. A bmp file consists of four parts: the bitmap file header, bitmap information header, palette, and image data, as shown in table 5-1. Table 5-1 Composition of the BMP file
Bitmap-File Header)
Bitmap-Info
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.