- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I wanna save image data in grayscale. I set the parameters as below. But the program always exits at the line "ijlWrite()". What is up?
image.DIBColor = IJL_G;//
image.DIBChannels = 1;
image.DIBPadBytes = IJL_DIB_PAD_BYTES(image.DIBWidth,1);
image.JPGColor = IJL_G;
image.JPGChannels = 1;
image.JPGSubsampling = IJL_NONE;
//////////////////////////////////////
For more details , please check the following code as below:
if( ijlInit( ℑ ) != IJL_OK ){
TRACE( "Can't initialize Intel JPEG library " );
return ;}
image.DIBWidth = nWidth;
image.DIBHeight = nHeight;
image.DIBBytes = pImgBuf;
// Setup JPEGimage.JPGFile =
const_cast<char*>("f:\11.jpg");image.JPGWidth = nWidth;
image.JPGHeight = nHeight;
image.DIBColor = IJL_G;
image.DIBChannels = 1;
image.DIBPadBytes = IJL_DIB_PAD_BYTES(image.DIBWidth,1);
image.JPGColor = IJL_G;
image.JPGChannels = 1;
image.JPGSubsampling = IJL_NONE; if( ijlWrite( ℑ, IJL_JFILE_WRITEWHOLEIMAGE ) != IJL_OK ){
TRACE( "Can't write image " );
return ;}
if( ijlFree( ℑ ) != IJL_OK ){
TRACE( "Can't free Intel JPEG library " );
return ;}
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hi,
code looks OK, probably you did not provide enough memory buffer. By the way, ijlWrite() function return error code which you can look at to get an idea what is the problem
Regards,
Vladimir
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hi, this is Naoki Moriuchi from Japan.
I think your problem is caused by IJL_DIB_PAD_BYTES macro.
Please try the following code for DIBPadBytes.
----------------------------------------------------------------------------------
int bitmap_width = ((jcprops.DIBWidth * 8 + 31) / 32) * 4;
jcprops.DIBPadBytes = (bitmap_width - jcprops.DIBWidth) * jcprops.DIBChannels;
----------------------------------------------------------------------------------
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Naoki,
IJL_DIB_PAD_BYTES should do the same calculations. I think it is possible to learn more if analise ijlWrite return code.
Regards,
Vladimir