0
我是這個庫的新手。 我想將所有gif文件轉換爲tif。以下是我的代碼。它只是第一次保存,在它拋出狀態= 2(無效參數)之後。 請幫我GDI +在循環中只保存一次圖像
do {
if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
wstring str(ffd.cFileName);
str = gifDir1 + str;
const wchar_t *filename = str.c_str();
Image *image = new Image(ffd.cFileName);
wstring str2(ffd.cFileName);
wstring::size_type found = str2.find(L".gif");
str2.replace(found, str2.length(), L".tif");
str2 = tifDir + str2;
const wchar_t *dstfilename = str2.c_str();
stat = image->Save(dstfilename, &encoderClsid, NULL);
if (stat == Ok)
printf("File was saved successfully\n");
else
printf("Failure: stat = %d\n", stat);
delete image;
}
} while (FindNextFileW(hFind, &ffd) != 0);
GdiplusShutdown(gdiplusToken);
return 0;
}