使用 FreeImage,我想为 DCINEMA 创建一个 j2c 文件并对其进行测试,但是,结果文件与 j2c 不兼容。
IfanView(图像软件)说“result.j2c”是一个扩展名不正确的 jp2 文件,并将其从 result.j2c 重命名为 result.jp2。
我不明白如何创建 j2c 文件。
我的代码如下:
RGBQUAD color;
GetDims( hOutputImage, &iWidth, &iHeight );
UCHAR* pSrc = ( UCHAR* )(Image->GetRaw( hOutputImage) );
FIBITMAP* bitmap = FreeImage_Allocate(iWidth, iHeight, 24);
for ( int i = 0; i < iHeight; i++) {
for( int j = 0 ; j < iWidth; j++) {
color.rgbRed = *( pSrc + 0 );
color.rgbGreen = *( pSrc + 1 );
color.rgbBlue = *( pSrc + 2 );
FreeImage_SetPixelColor(bitmap, j, i , &color);
pSrc += 4;
}
}
static int index = 0;
CString fileName;
fileName.Format("c:\\%06d.j2c", index++);
const char *ss = (LPSTR)(LPCTSTR) fileName;
FreeImage_Save(FIF_J2K, bitmap, ss, J2K_DEFAULT );
我应该怎么办?