- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ;}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
----------------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page