前提
bmpファイルの色の替え方がわかりません。
実現したいこと
bmpファイルの色を変更する
該当のソースコード
#include<stdio.h> #include<stdlib.h> #include<stdint.h> int main(int argc,char *argv[]){ uint32_t width,height; uint8_t w[4],h[4]; FILE *fp; if(argc!=2){ fprintf(stderr,"Usage:%sfilename\n",argv[0]); exit(1); } fp=fopen(argv[1],"rb"); if(fp==NULL){ fprintf(stderr,"File %s not opened\n",argv[1]); exit(1); } fseek(fp,16,SEEK_SET); fread(w,sizeof(uint8_t),4,fp); fread(h,sizeof(uint8_t),4,fp); fclose(fp); width=((w[0]*256+w[1])*256+w[2])*256+w[3]; height=((h[0]*256+h[1])*256+h[2])*256+h[3]; printf("%s: width=%d,height=%d\n",argv[1],width,height); return 0; }
これを一部変えればbmpファイルの色を変更できるといわれたのですがどこを書き換えればいいのかわからないので教えて欲しいです。
./a.out (Bの指定色)(Gの指定色)(Rの指定色)
でbmpファイルの全体の色を変更するようにしなければなりません。

0 コメント