0
我試圖在FreeImage中加載.png
和.DDS
文件,但寬度和高度始終爲零。FreeImage零寬度和高度
#include <stdio.h>
#include<stdlib.h>
#include <FreeImage.h>
int main(void){
const char* path = "Signal.png";
printf("Loading image %s\n", path);
FIBITMAP* image = FreeImage_Load(FreeImage_GetFileType(path), path, 0);
unsigned int w = FreeImage_GetWidth(image);
unsigned int h = FreeImage_GetHeight(image);
printf("Width: %u Height: %u\n", w, h);
}
輸出:
Loading image Signal.png
Width: 0 Height: 0
見'FreeImage_SetOutputMessage'文檔,並使用它,也許你會收到一條錯誤消息。你也可能錯過了對FreeImage_Initialise的調用。 – user2802841