您好,我正在开发一个程序,将 640x480 位图图像缩小为 320x240 图像。我已经研究这个问题有一段时间了,但我发现的所有好的例子都是为了增加图像的大小。
(参见此处:http://cboard.cprogramming.com/c-programming/154737-help-program-resize-image.html)
我很难将该计划中所做的事情转化为我需要完成的事情。到目前为止,这是我的代码:
include stdio.h
include stdlib.h
include string.h
include math.h
pragma pack(push, 1)
typedef struct tagBITMAPFILEHEADER
{
unsigned short bfType; //specifies the file type
unsigned int bfSize; //specifies the size in bytes of the bitmap file
unsigned short bfReserved1; //reserved; must be 0
unsigned short bfReserved2; //reserved; must be 0
unsigned int bfOffBits; //species the offset in bytes from the bitmapfileheader to the bitmap bits
} BITMAPFILEHEADER;
pragma pack(pop)
pragma pack(push, 1)
typedef …Run Code Online (Sandbox Code Playgroud)