主要是buffer(bmp)->buffer(jpeg),哪位高人指点一下,给个例子看看,不胜感激!!!

解决方案 »

  1.   

    int RGBToJpeg(int nWidth,      // 位图图像宽
         int nHeight,      // 位图图像高
         BYTE* pDIBits,    // 位图纯数据
         int nQuality,      // Jpg文件压缩质量(0 - 100)
         int nJpgSizeBytes,// 保存Jpg文件的内存大小
         BYTE* pJpgBuf      // 保存Jpg文件的内存指针
         )
    {
    AFX_MANAGE_STATE(AfxGetStaticModuleState());

    if (!pDIBits || nWidth < 0 || nHeight < 0 || nQuality < 0 || 
    nQuality > 100 || nJpgSizeBytes <= 0)
    {
    return 0;
    } JPEG_CORE_PROPERTIES jcprops = {0};
    if (ijlInit(&jcprops) != IJL_OK)
    {
    return 0;
    } jcprops.DIBBytes  = pDIBits;
    jcprops.DIBWidth  = nWidth;
    jcprops.DIBHeight  = nHeight; jcprops.JPGBytes  = pJpgBuf;
    jcprops.JPGSizeBytes   = nJpgSizeBytes;
    jcprops.JPGWidth  = nWidth;
    jcprops.JPGHeight  = nHeight;
    jcprops.jquality  = nQuality; int jpgsize = -1;
    if (ijlWrite(&jcprops, IJL_JBUFF_WRITEWHOLEIMAGE) == IJL_OK)
    {
    jpgsize = jcprops.JPGSizeBytes;
    }

    ijlFree(&jcprops); return jpgsize;
    }
      

  2.   

    请问Arlene_cn(茴香) :
    BYTE* pDIBits是不是可以从文件上读取的去掉头的数据呢?
      

  3.   

    知道是"位图纯数据"了,但这个数据并没有告诉我bmp(buf)->jpeg(buf)转换后的数据啊?
      

  4.   

    对不起,写少了,知道是"位图纯数据"了,但这个数据并没有告诉我bmp(buf)->jpeg(buf)转换后的数据长度是多少啊?