日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

c语言图片见水印,[求助]C语言 bmp文件加上水印

發布時間:2024/4/19 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c语言图片见水印,[求助]C语言 bmp文件加上水印 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

該樓層疑似違規已被系統折疊?隱藏此樓查看此樓

給一張圖片加水印后存起來然后顯示出來

有部分源碼 求高手幫忙完成~!

#include

#include

/* structure defiens bitmap header */

struct BITMAPFILEHEADER{

unsigned short type;/* type of file (bit map) */

unsigned long size;/* size of file */

unsigned short reserved1;/* */

unsigned short reserved2;/* */

unsigned long offsetbits;/* off set bits */

};

struct BITMAPINFOHEADER{

unsigned long size;/* bitmap size */

unsigned long width;/* width of bitmap */

unsigned long height;/* hight of bitmap */

unsigned short planes;

unsigned short bitcount;

unsigned long compression;/* compression ratio (zero for no compression) */

unsigned long sizeimage;/* size of image */

long xpelspermeter;

long ypelspermeter;

unsigned long colorsused;

unsigned long colorsimportant;

};

struct SINGLE_PIXEL{

unsigned char blue; /* Blue level 0-255 */

unsigned char green;/* Green level 0-255 */

unsigned char red; /* Red level 0-255 */

};

int main()

{

unsigned long int i=0;/* to count pixels readed */

unsigned long int S=0;/* number of pixcels to read */

struct BITMAPFILEHEADER source_head;/* to store file header */

struct BITMAPINFOHEADER source_info;/* to store bitmap info header */

struct SINGLE_PIXEL source_pix;/* to store pixcels */

FILE *fp;/* file pointer for source file */

FILE *Dfp;/* file ponter for distenation file */

if(!(fp=fopen("E:\\c_prac\\WK_canD\\rt.bmp","rb")))/* open in binery read mode */

{

printf("\can not open file");/* prind and exit if file open error */

getch();

exit(-1);

}

Dfp=fopen("dist.bmp","wb");/* opne in binery write mode */

/* read the headers to souirce file */

fread(&source_head,sizeof(struct BITMAPFILEHEADER),1,fp);

fread(&source_info,sizeof(struct BITMAPINFOHEADER),1,fp);

/* write the headers to distenation file */

fwrite(&source_head,sizeof(struct BITMAPFILEHEADER),1,Dfp);

fwrite(&source_info,sizeof(struct BITMAPINFOHEADER),1,Dfp);

/* calucate the number of pix to read */

S=source_info.width*source_info.height;

/* read, modefy and write pixcels */

for(i=1;i<=S;i++)

{

/* read pixcel form source file */

fread(&source_pix,sizeof(struct SINGLE_PIXEL),1,fp);

/*modefy

/* source_pix.green; */

/* source_pix.blue; */

/* source_pix.blue; */

*/

/* write pixcels to distenation file */

fwrite(&source_pix,sizeof(struct SINGLE_PIXEL),1,Dfp);

}

/* close all fiels */

fclose(fp);

fclose(Dfp);

return 0;

}

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的c语言图片见水印,[求助]C语言 bmp文件加上水印的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。