隨筆-17  評(píng)論-64  文章-79  trackbacks-1
          #define? ULONG_PTR? void*
          #include<gdiplus.h>??
          #include<GdiPlusEnums.h>
          #pragma comment(lib,"GdiPlus.lib")
          using namespace Gdiplus;
          int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)??
          {
          ?? UINT? num = 0;????????? // number of image encoders
          ?? UINT? size = 0;???????? // size of the image encoder array in bytes
          ?? GdiplusStartupInput gdiplusStartupInput;
          ?? ULONG_PTR?????????? gdiplusToken;
          ?? GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
          ?? ImageCodecInfo* pImageCodecInfo = NULL;
          ?? GetImageEncodersSize(&num, &size);
          ?? if(size == 0)??
          ??? return -1;? // Failure
          ?? pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
          ?? if(pImageCodecInfo == NULL)
          ??? return -1;? // Failure
          ?? GetImageEncoders(num, size, pImageCodecInfo);
          ?? for(UINT j = 0; j < num; ++j)??
          ?? {?
          ??? if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )??
          ??? {
          ???? *pClsid = pImageCodecInfo[j].Clsid;
          ???? free(pImageCodecInfo);
          ???? return j;? // Success?
          ??? }????
          ?? }
          ?? free(pImageCodecInfo);
          ?? GdiplusShutdown(gdiplusToken);
          ?? return -1;? // Failure?
          }?
          ?
          void BMP2JPG(CString strBMPFile,CString strJPGFile)
          {
          ??? CLSID? encoderClsid;
          ??? WCHAR? strGuid[39];
          ??? if(GetEncoderClsid(L"image/jpeg", &encoderClsid) >= 0)
          ??? StringFromGUID2(encoderClsid, strGuid, 39);
          ??? Image image(strBMPFile.AllocSysString());
          ??? image.Save(strJPGFile.AllocSysString(),&encoderClsid,NULL);
          }
          posted on 2007-02-27 19:26 飛鳥(niǎo) 閱讀(2365) 評(píng)論(7)  編輯  收藏 所屬分類: VC

          評(píng)論:
          # re: bmp轉(zhuǎn)JPG 2008-03-26 13:43 | 就不告訴你
          垃圾,說(shuō)是java,寫(xiě)的卻是c的代碼  回復(fù)  更多評(píng)論
            
          # re: bmp轉(zhuǎn)JPG 2008-03-26 14:13 | 飛鳥(niǎo)
          你是不是傻啊,沒(méi)看到是分在VC類里面,我看你還是不要學(xué)編程了  回復(fù)  更多評(píng)論
            
          # re: bmp轉(zhuǎn)JPG 2008-03-27 00:21 | 21
          # re: bmp轉(zhuǎn)JPG 2008-04-26 22:10 | HE YOU BING
          # re: bmp轉(zhuǎn)JPG 2008-11-23 03:57 | changzihao
          # re: bmp轉(zhuǎn)JPG[未登錄](méi) 2009-08-20 15:35 | 無(wú)名
          @就不告訴你
          腦殘  回復(fù)  更多評(píng)論
            
          # re: bmp轉(zhuǎn)JPG 2010-02-24 00:04 | lya.79
          他應(yīng)該是看到 "飛鳥(niǎo)JAVA" 這東西,所以誤以為怎會(huì)放在java區(qū)裡吧,誤會(huì)一場(chǎng)哈。  回復(fù)  更多評(píng)論
            
          主站蜘蛛池模板: 邢台县| 田阳县| 侯马市| 平和县| 怀柔区| 黄大仙区| 家居| 闻喜县| 侯马市| 东乌珠穆沁旗| 泰顺县| 余姚市| 岱山县| 中牟县| 婺源县| 博客| 陵水| 河西区| 大理市| 枝江市| 庐江县| 新沂市| 陵水| 隆安县| 巴里| 米林县| 双牌县| 瓮安县| 武夷山市| 措勤县| 长子县| 巨野县| 马尔康县| 隆尧县| 沙田区| 高阳县| 巨鹿县| 航空| 腾冲县| 广南县| 金川县|