24位深,16位深 BMP 图片解析

//====================================================

//   bmp.h头文件

//====================================================

#ifndef __BMAPPARSER_H__
#define __BMAPPARSER_H__
#include "nvtfat.h"
#include "wbtypes.h"
typedef struct BMP_FILE_HEADER_S
{
     unsigned short bfType;              //UNIT        bfType;
     unsigned int   bfSize;              //DWORD       bfSize;
     unsigned short bfReserved1;         //UINT        bfReserved1;
     unsigned short bfReserved2;         //UINT        bfReserved2;
     unsigned int   bfOffBits;           //DWORD       bfOffBits;
}BMP_FILE_HEADER;


typedef struct BMP_INFO_HEADER_S
{
     unsigned int   biSize ;              // DWORD        biSize;
     unsigned int   biWidth;                // LONG         biWidth;
     unsigned int   biHeight;               // LONG         biHeight;
     unsigned short   biPlanes;               // WORD         biPlanes;
     unsigned short   biBitCount;             // WORD         biBitCount;
     unsigned int   biCompression;          // DWORD        biCompression;
     unsigned int   biSizeImage;            // DWORD        biSizeImage;
     unsigned int   biXPelsPerMerer;        // LONG         biXPelsPerMerer;//水平分辨率
     unsigned int   biYPelsPerMerer;      // LONG         biYPelsPerMerer;//垂直分辨率
     unsigned int biClrUsed;              // DWORD        biClrUsed;
     unsigned int biClrImportant;         // DWORD        biClrImportant;

}BMP_INFO_HEADER;

typedef struct BMP_KEY_PARA_S
{

    unsigned int   biSize ;
    unsigned int   width;
    unsigned int   height;
    unsigned short biBitCount;
    unsigned int *buf;
  
}BMP_KEY_PARA;

 


typedef struct FRAME_BUF_S
{
    unsigned int width;
    unsigned int height;
    unsigned int *buf;
//    UINT8 open_flag;
}FRAME_BUF;

 

#define ERR_IMAGE_NULL          0
#define ERR_IMAGE_READ          1
#define ERR_IMAGE_FORMAT        2
#define ERR_IMAGE_MALLOC_FAIL   3
#define ERR_IMAGE_SIZE_MATCH    4
#define ERR_IMAGE_NOT_SUPPORT   5

void bmpFileTest(int hFile);
void bmpHeaderPartLength(int hFile);
void BmpWidthHeight(int hFile);//获取BMP文件
void bmpFileHeader(int hFile);//获取BMP文件头信息
void bmpInfoHeader(int hFile);//获取BMP文件图像信息
void getbmpFileHeader(int hFile,BMP_FILE_HEADER *file_head);

void getbmpInfoHeader(int hFile ,BMP_INFO_HEADER *bmp_info);
INT32 getbmpData(int hFile, FRAME_BUF *frameBuf);//将BMP文件数据 取出放到 frameBuf 中
UINT8 Save_bmp_file( int fd, BMP_KEY_PARA bmpData);
#endif
//========================================================================================================

//bmp.c

//========================================================================================================

/* File name:   bmpTest.c
   Author:      wenson
   Date:        2016-07-18
   Description: Show all Info a bmp file has. including
   FileHeader Info, InfoHeader Info and Data Part.
*/
#include "Bmp.h"
#include "wblib.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
//#include "config.h"


#define BITMAPFILEHEADERLENGTH 14   // The bmp FileHeader length is 14
#define BM 19778                    // The ASCII code for BM

unsigned int OffSet = 0;    // OffSet from Header part to Data Part
long BmpWidth = 0;          // The Width of the Data Part
long BmpHeight = 0;         // The Height of the Data Part

/* Test the file is bmp file or not */
void bmpFileTest(int hFile)
{    
     unsigned short bfType = 0;
     int rnByte =  0; //实际读出的数据长度
    
     fsFileSeek(hFile, 0L, SEEK_SET);
    // fsReadFile(&bfType, sizeof(char), 2, fpbmp);
     fsReadFile(hFile, (UINT8 *)&bfType ,sizeof(bfType), &rnByte);
     if (BM != bfType)
     {
      sysprintf("This file is not bmp file.!!!\n");
     }
}

/* To get the OffSet of header to data part */
void bmpHeaderPartLength(int hFile)
{
    int rnByte =  0;
   
     fsFileSeek(hFile, 10L, SEEK_SET);
     fsReadFile(hFile, (UINT8 *)&OffSet, 4, &rnByte);   
     //sysprintf("The Header Part is of length %d.\n", OffSet);
}

/* To get the width and height of the bmp file */
void BmpWidthHeight(int hFile)
{
    int rnByte =  0;
     fsFileSeek(hFile, 18L, SEEK_SET);
     fsReadFile(hFile, (UINT8 *)&BmpWidth ,sizeof(BmpWidth), &rnByte);
     fsReadFile(hFile, (UINT8 *)&BmpHeight ,sizeof(BmpHeight), &rnByte);
}

void getbmpFileHeader(int hFile,BMP_FILE_HEADER *file_head)//14 BYTE
{
     int rnByte;
     unsigned short bfType = 0;              //UNIT        bfType;
     unsigned int   bfSize = 0;              //DWORD       bfSize;
     unsigned short bfReserved1 = 0;         //UINT        bfReserved1;
     unsigned short bfReserved2 = 0;         //UINT        bfReserved2;
     unsigned int   bfOffBits = 0;           //DWORD       bfOffBits;
     
     fsFileSeek(hFile, 0L, SEEK_SET);
    
     fsReadFile(hFile, (UINT8 *)&bfType ,2, &rnByte);
     fsReadFile(hFile, (UINT8 *)&bfSize ,4, &rnByte);
     fsReadFile(hFile, (UINT8 *)&bfReserved1 ,2, &rnByte);
     fsReadFile(hFile, (UINT8 *)&bfReserved2 ,2, &rnByte);
     fsReadFile(hFile, (UINT8 *)&bfOffBits ,4, &rnByte);

     file_head->bfType = bfType;
     file_head->bfSize = bfSize;
     file_head->bfReserved1 = 0;
     file_head->bfReserved1 = 0;
     file_head->bfOffBits = bfOffBits;


#if 0
     sysprintf("************************************************\n");
     sysprintf("*************tagBITMAPFILEHEADER info***********\n");
     sysprintf("************************************************\n");
     sysprintf("bfType              is %d.\n", bfType);
     sysprintf("pic file Size       is %d.\n", bfSize);
     sysprintf("bfReserved1         is %d.\n", bfReserved1);
     sysprintf("bfReserved2         is %d.\n", bfReserved2);
     sysprintf("bfOffBits           is %d.\n", bfOffBits);
#endif


}
/* get tagBITMAPINFOHEADER info */
void getbmpInfoHeader(int hFile ,BMP_INFO_HEADER *bmp_info)
{
    int rnByte;
   
     unsigned int biSize = 0;               // DWORD        biSize;
     unsigned short biWidth = 0;                // LONG         biWidth;
     unsigned short biHeight=0;               // LONG         biHeight;
     unsigned int biPlanes=0;               // WORD         biPlanes;
     unsigned int biBitCount=0;             // WORD         biBitCount;
     unsigned int biCompression=0;          // DWORD        biCompression;
     unsigned int biSizeImage=0;            // DWORD        biSizeImage;
     unsigned int biXPelsPerMerer=0;        // LONG         biXPelsPerMerer;//水平分辨率
     unsigned int biYPelsPerMerer=0;        // LONG         biYPelsPerMerer;//垂直分辨率
     unsigned int biClrUsed=0;              // DWORD        biClrUsed;
     unsigned int biClrImportant=0;         // DWORD        biClrImportant;

     fsFileSeek(hFile, 14L, SEEK_SET);

     fsReadFile(hFile,(UINT8 *)&biSize, 4, &rnByte);
     fsReadFile(hFile,(UINT8 *)&biWidth, 4, &rnByte);
     fsReadFile(hFile,(UINT8 *)&biHeight, 4, &rnByte);
     fsReadFile(hFile,(UINT8 *)&biPlanes, 2, &rnByte);
     fsReadFile(hFile,(UINT8 *)&biBitCount,2, &rnByte);
     fsReadFile(hFile,(UINT8 *)&biCompression, 4, &rnByte);
     fsReadFile(hFile,(UINT8 *)&biSizeImage, 4, &rnByte);
     fsReadFile(hFile,(UINT8 *)&biXPelsPerMerer, 4, &rnByte);
     fsReadFile(hFile,(UINT8 *)&biYPelsPerMerer, 4, &rnByte);
     fsReadFile(hFile,(UINT8 *)&biClrUsed, 4, &rnByte);
     fsReadFile(hFile,(UINT8 *)&biClrImportant, 4, &rnByte);

     bmp_info->biSize          = biSize;//bmpInfoHeader size
     bmp_info->biWidth         = biWidth;
     bmp_info->biHeight        = biHeight;
     bmp_info->biBitCount      = biBitCount;
     bmp_info->biCompression   = biCompression;
     bmp_info->biSizeImage     = biSizeImage;
     bmp_info->biXPelsPerMerer = biXPelsPerMerer;
     bmp_info->biYPelsPerMerer = biYPelsPerMerer;
     bmp_info->biClrUsed       = biClrUsed;
     bmp_info->biClrImportant  = biClrImportant;
    
#if 0
     sysprintf("************************************************\n");
     sysprintf("*************tagBITMAPINFOHEADER info***********\n");
     sysprintf("************************************************\n");
     sysprintf("biSize              is %d. \n", biSize);
     sysprintf("biWidth             is %d.\n", biWidth);
     sysprintf("biHeight            is %d.\n\n", biHeight);
     sysprintf("biPlanes            is %d. \n", biPlanes);   
     sysprintf("biBitCount          is %d. \n", biBitCount);
     sysprintf("biCompression       is %d. \n", biCompression);
     sysprintf("biSizeImage         is %d Bytes. \n", biSizeImage);
     sysprintf("biXPelsPerMerer     is %d.\n", biXPelsPerMerer);
     sysprintf("biYPelsPerMerer     is %d.\n", biYPelsPerMerer);
     sysprintf("biClrUsed           is %d. \n", biClrUsed);
     sysprintf("biClrImportant      is %d. \n", biClrImportant);
   
#endif
    
}

/*
function: getdata from *.bmp
input:file handle ,read data storage buf
output: no output
return: no return
*/

unsigned int getBmpDataSize(int fd)
{
  int rnByte = 0; 
  unsigned int size = 0;

  fsFileSeek(fd, 34L, SEEK_SET);
  fsReadFile(fd,(unsigned char *)&size, 4, &rnByte);

  return size;
}
/*
*  将888数据 转为565数据
*/
void rgb888_to_rgb565(const void * psrc, int w, int h, void * pdst)   
{   
    int srclinesize = (w * 3);   
    int dstlinesize = (w * 2);   
       
    const unsigned char * psrcline;   
    const unsigned char * psrcdot;
    unsigned char  * pdstline;   
    unsigned short * pdstdot;   
       
    int i,j;   
       
    if (!psrc || !pdst || w <= 0 || h <= 0)
    {
        sysprintf("rgb888_to_rgb565 : parameter error\n");   
        return;   
    }   
   
    psrcline = (const unsigned char *)psrc;   
    pdstline = (unsigned char *)pdst;   
    for (i=0; i<h; i++) {   
        psrcdot = psrcline;   
        pdstdot = (unsigned short *)pdstline;   
        for (j=0; j<w; j++) {
            //888 r|g|b -> 565 b|g|r   
            *pdstdot =   ((psrcdot[2] & 0xF8) << 8)//r   
                        |((psrcdot[1] & 0xFC) << 3)//g   
                        | (psrcdot[0] >> 3);//b   
            psrcdot += 3;   
            pdstdot++;   
        }   
        psrcline += srclinesize;   
        pdstline += dstlinesize;   
    }
    return ;   
}   


//get data from bmp file to point buf
INT32 getbmpData(int hFile, FRAME_BUF *frameBuf)
{
     int i;
     int result;
     int rnByte;

     UINT8 *sourceBuf = NULL,*targetBuf = NULL;
     unsigned int   bmpdatalen = 0;

     BMP_FILE_HEADER bmpFileHeadr;
     BMP_INFO_HEADER bmpInfoHeadr;
        
     getbmpFileHeader(hFile,(BMP_FILE_HEADER *)&bmpFileHeadr);
     getbmpInfoHeader(hFile,(BMP_INFO_HEADER *)&bmpInfoHeadr);

     //check BMP type
     if (BM != bmpFileHeadr.bfType)
     {
        sysprintf("the pic is not bmp format!!!\n");
        return ERR_IMAGE_FORMAT;
     }

     if(( bmpInfoHeadr.biBitCount != 24)&&( bmpInfoHeadr.biBitCount != 16))
     {
        sysprintf(" not support the %d bits bmp\n",bmpInfoHeadr.biBitCount);
        return ERR_IMAGE_NOT_SUPPORT;
     }

     if((bmpInfoHeadr.biHeight != frameBuf->height)||(bmpInfoHeadr.biWidth != frameBuf->width))
     {
      sysprintf(" frame buf size not match pic !!!!\n");
      return ERR_IMAGE_SIZE_MATCH;
     }
  
     fsFileSeek(hFile, bmpFileHeadr.bfOffBits, SEEK_SET);
     bmpdatalen = bmpInfoHeadr.biWidth * bmpInfoHeadr.biBitCount / 8;
      
     sourceBuf = (UINT8 *)malloc(bmpdatalen);
        if(sourceBuf == NULL){
          sysprintf("malloc pic tempbuf fail!!!\n");
          return ERR_IMAGE_MALLOC_FAIL;
         }
        
    targetBuf = (UINT8 *)frameBuf->buf + (frameBuf->height - 1) * frameBuf->width * 2;
    for(i = 0 ; i < bmpInfoHeadr.biHeight ; i++){
        result = fsReadFile(hFile,sourceBuf ,(bmpdatalen), &rnByte);
        if(result != FS_OK)
            {
                sysprintf("fs read error!!!\n");
                free(sourceBuf);
                return ERR_IMAGE_READ;
            }
           
        if(bmpInfoHeadr.biBitCount == 24)
        {
            rgb888_to_rgb565(sourceBuf,(bmpInfoHeadr.biWidth),1,sourceBuf);
        }
       
        memcpy(targetBuf,sourceBuf,frameBuf->width * 2);
        targetBuf -= ( frameBuf->width * 2 );
      }
     
    free(sourceBuf);
    return  ERR_IMAGE_NULL;
}


UINT8 Save_bmp_file( int fd, BMP_KEY_PARA bmpData)
{
    int i;
    int wnByte = 0;  //实际写入的数据长度
    BMP_FILE_HEADER g_bmpFileHeadr;
    BMP_INFO_HEADER g_bmpInfoHeadr;
    UINT8 *pbuf = NULL,*temp_buf = NULL;
    UINT32 data_len;
    UINT8 aline4_offset = 0;

    if(fd < 0)
    {
        sysprintf("save fd error!!!\n");
        return 1;
    }
    else
    {
        sysprintf("save fd start!!!\n");
    }
    data_len = bmpData.width * bmpData.height * bmpData.biBitCount / 8;

    aline4_offset = ((data_len+54) % 4);
    if(aline4_offset)
    {
     aline4_offset  = 4 - aline4_offset;
     data_len += (4 - aline4_offset);
    }
   
   //位图文件头
    g_bmpFileHeadr.bfType        = BM;
    g_bmpFileHeadr.bfSize        = data_len+54;

    g_bmpFileHeadr.bfReserved1   = 0x0000;
    g_bmpFileHeadr.bfReserved2   = 0x0000;
    g_bmpFileHeadr.bfOffBits     = 54;
     //位图信息头格式定义
    g_bmpInfoHeadr.biSize        = 40;
    g_bmpInfoHeadr.biWidth       = bmpData.width;
    g_bmpInfoHeadr.biHeight      = bmpData.height;
    g_bmpInfoHeadr.biPlanes      = 1;
    g_bmpInfoHeadr.biBitCount    = bmpData.biBitCount;
    g_bmpInfoHeadr.biCompression = 0;
 
    g_bmpInfoHeadr.biSizeImage     = data_len; //位图阵列表字节数
    g_bmpInfoHeadr.biXPelsPerMerer = 0;//水平分辨率
    g_bmpInfoHeadr.biYPelsPerMerer = 0; //垂直分辨率
    g_bmpInfoHeadr.biClrUsed       = 0;  //位图实际使用的颜色表中的颜色变址数
    g_bmpInfoHeadr.biClrImportant  = 0; //位图显示过程中被认为重要颜色变址数

   

    data_len = bmpData.width * bmpData.biBitCount / 8;
   
    temp_buf = (unsigned char *)malloc(data_len);
    if(temp_buf <= 0)
    {
     sysprintf("save malloc buf fail....\n");
     return 1;
    }

    fsFileSeek(fd,0,SEEK_SET);
    fsWriteFile(fd, (UINT8 *)&g_bmpFileHeadr.bfType, 2, &wnByte); 
    fsWriteFile(fd, (UINT8 *)&g_bmpFileHeadr.bfSize, 12, &wnByte); 
    fsWriteFile(fd, (UINT8 *)&g_bmpInfoHeadr, 40, &wnByte);
   
    pbuf = (UINT8 *)bmpData.buf + (bmpData.height - 1) * data_len;
   
    for( i = 0 ;i < bmpData.height ; i++) 
      {
        memcpy(temp_buf, pbuf,data_len);
        fsWriteFile(fd,temp_buf, data_len, &wnByte);
        pbuf -= data_len;
      }
     
    memset(temp_buf,0x0,4);
    if(aline4_offset > 0)
    {
      sysprintf(" aline4_offset %d ....\n",aline4_offset); 
      fsWriteFile(fd,temp_buf, aline4_offset, &wnByte); 
    }
   
    free(temp_buf);
    temp_buf = NULL;
    return 0;
}

 

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
一直以来,很难找到一款体积小,能绿色执行,又功能丰富的图像处理软件,Imageshop 2.0的发布就是为了解决这个问题而存在的。 Imageshop2.0仍为单EXE文件,大小只有800多KB,对于目前任何移动设备来说这个大小都是小菜一碟。功能融合了常用图像处理各多个方面,能满足普通和专业用户在日常生活中调整图像的基本需求,对于熟悉PS的用户使用上更是得心应手。 在程序的界面上,完全模仿PS CS5,支持多图像处理,菜单和很多快捷键也按照PS做相同的设置。 在图像格式支持上,Imageshop2.0在很多方面都做到了第一。1:完备的BMP图像支持能力,能全面支持1到32BMP的处理,并且能在尽量减少视觉损失的情况下,在各种位深之间进行转换,特别是16图像,增加了连PS都不支持的抖动选项,能解决用户在将真彩色图像转换为高彩色时的失真问题。2、能支持多达25种图像的解析,其中不乏很多很专业的图像。3、在保存图像时支持多种该格式可用的选项,而不是像很多其他类软件草草了事。   程序设有很多国内图像软件都没有专业的选区功能,对所作选区可以进行羽化、平滑、收缩等操作,满足高端用户的需求。 在图像调节上,Imageshop2.0在第一版的基础上做了大量的改进和增添,在用户体验上也进行了改进,是用户更改图像更为方便快捷有效。 滤镜方面,更是有了较大的变动,一是大幅提高了原有部分滤镜的执行速度,同时增加更多有创意的滤镜。 同时,软件还增添了很多新功能,这些功能无论是对于图像爱好者还是图像编程者都有一定的帮助。 当然,程序还有不完美的地方,我会不断的改进的,希望大家喜欢这款软件。
void CExample10View::OnSave555BiBitfields() { // TODO: Add your command handler code here if(lpBmpDataBuf==NULL) { MessageBox("当前没有打开的图"); return; } BYTE r,g,b; LPBYTE lpDest,lpSrc; int i,j; int nheapSize; CFileDialog filesavebox(FALSE,"bmp","BI_BITFIELDS.bmp",OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,"files(*.bmp)|*.bmp|",NULL); CFile file; CString strPathname; if(m_bmi.biBitCount!=24) { MessageBox("当前打开的图不是24图"); return; } memcpy(&m_newbmf,&m_bmf,sizeof(BITMAPFILEHEADER)); memcpy(&m_newbmi,&m_bmi,sizeof(BITMAPINFOHEADER)); m_newbmi.biBitCount=16; m_newbmi.biCompression=BI_BITFIELDS;//即3 m_newbmi.biSizeImage=WIDTHBYTES(m_newbmi.biWidth,m_newbmi.biBitCount)*m_newbmi.biHeight; m_newbmf.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+sizeof(DWORD)*3 +WIDTHBYTES(m_newbmi.biWidth,m_newbmi.biBitCount)*m_newbmi.biHeight; m_newbmf.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+sizeof(DWORD)*3; nheapSize=sizeof(BITMAPINFOHEADER)+sizeof(DWORD)*3 +WIDTHBYTES(m_newbmi.biWidth,m_newbmi.biBitCount)*m_newbmi.biHeight; if(lpnewBmpDataBuf!=NULL) { delete []lpnewBmpDataBuf; lpnewBmpDataBuf=NULL; } lpnewBmpDataBuf=new BYTE[nheapSize]; memcpy(lpnewBmpDataBuf,&m_newbmi,sizeof(BITMAPINFOHEADER)); DWORD* lp=(DWORD*)(lpnewBmpDataBuf+sizeof(BITMAPINFOHEADER)); *lp++=0x00007c00; *lp++=0x000003e0; *lp =0x0000001f; for(i=0;i<m_newbmi.biHeight;i++) { for(j=0;j<m_newbmi.biWidth;j++) { lpSrc=lpBmpDataBuf+sizeof(BITMAPINFOHEADER) +WIDTHBYTES(m_bmi.biWidth,m_bmi.biBitCount)*(m_bmi.biHeight-1-i) +j*3; lpDest=lpnewBmpDataBuf+sizeof(BITMAPINFOHEADER)+sizeof(DWORD)*3 +WIDTHBYTES(m_newbmi.biWidth,m_newbmi.biBitCount)*(m_newbmi.biHeight-1-i) +j*2; b=*lpSrc++; b&=0xf8; g=*lpSrc++; g&=0xf8; r=*lpSrc++; r&=0xf8; WORD* lp=(WORD*)lpDest; *lp=0; *lp=r<<7; *lp+=(g<>3); } } if(filesavebox.DoModal()!=IDOK) return; strPath
### 回答1: 一个24BMP图像文件可以通过以下步骤准备: 1. 打开图像编辑软件,例如Photoshop或GIMP。 2. 创建一个新的图像文件,设置图像的宽度和高度。 3. 选择24颜色模式,确保图像使用RGB颜色模式。 4. 绘制或导入你想要的图像。 5. 保存图像文件,选择BMP格式,并确保选择24颜色深度。 6. 输入文件名并保存文件。 这样就可以准备一个24BMP图像文件了。 ### 回答2: 要准备一个24BMP图像文件,需要按照以下步骤进行: 1. 打开一个图像编辑软件,例如Photoshop或GIMP。 2. 创建一个新的图像文件,设置图像的大小和分辨率。选择24颜色模式,这可以确保每个像素使用24颜色编码。 3. 绘制或导入你想要在图像中显示的图案或图片。这可以是任何你喜欢的图像,例如照片、插图或图形设计等。 4. 对图像进行编辑和调整,例如改变颜色、对比度、亮度和饱和度等。确保你得到了你满意的效果。 5. 编辑和调整图像后,保存图像文件。选择BMP格式,并设置24色深。这将生成一个24BMP图像文件。 6. 选择保存的目录和文件名,并点击保存按钮。这样,你就完成了一个24BMP图像文件的准备。 请注意,BMP文件通常比其他图像格式的文件更大,因为它不具有任何压缩功能。因此,你可能需要确保你的计算机有足够的存储空间来存储和处理这个文件。另外,24BMP图像文件可以显示数百万种颜色,使图像看起来更加细致和逼真。 ### 回答3: 准备一个24BMP图像文件需要以下步骤: 1. 确定图像尺寸和分辨率:确定所需图像的宽度和高度,以及像素分辨率。这些参数决定了图像文件的大小和清晰度。 2. 创建一个空的BMP文件:使用合适的图像编辑软件或编程语言创建一个空的BMP文件,并设置文件头信息。 3. 分配存储空间:计算出每行像素所需的字节数,并根据图像尺寸分配足够的存储空间。 4. 设置像素颜色:通过修改分配的存储空间中的特定字节,设置每个像素的颜色值。24BMP文件使用RGB颜色模式,每个像素需要3个字节来存储红色、绿色和蓝色通道的值。 5. 保存BMP文件:将修改后的存储空间保存为BMP文件。确保将图像文件保存为24BMP格式,以确保正确解析和显示图像。 要注意的是,这只是一种简单的方法来准备24BMP图像文件,并不涉及图像处理或处理复杂的图像操作。如果需要更高级的图像处理,可能需要使用专业的图像编辑软件或编程语言来完成。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值