bmp to jpeg 能在内存中转换吗 一般的bmp to jpeg 都是在生成jpg文件时使用,能否建立一个buffer,在bmp-buffer和jpg--buffer中作转换.不需要openfile(X_file),fclose(X_file)等在硬盘的存取操作. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以查阅WIC的资料或者利用GDI+也可以。 Bitmap bmp( L"你的bmp文件" );Bitmap bmp2( bmp.getWidth(), bmp.getHeight() );Graphics g( bmp2 );g.DrawImage( &bmp, 0, 0 );SaveToJpg( bmp2 );// 需要自己写SaveToJpg,还需要GetEncoderClsid等函数,查找GDI+相关例子。 vc60.支持gdi+吗?还是需要改为vc.net? CreateStreamOnHGlobalImage::Save(IStream*,CLSID*,EncoderParameters*) 支持,我刚在6.0下用gdi+做了转tiff格式的。 修正一下,我是装了windows sdk 谢谢sc3590,还想了解如何处理window.sdk,是如何下载,运行. gdi+好像有单独的开发包,单下一个也行。 按照各位的指导,下载和配置sdk,vc6.0,winXP,按hellowithsmile的提示运行,但没有显示;请帮忙查看一下错在哪.1. StdAfx.h#define ULONG_PTR unsigned long#include <Gdiplus.h>using namespace Gdiplus;//#define ULONG_PTR ULONG //#include <gdiplus.h>//using namespace Gdiplus;#pragma comment(lib, "gdiplus.lib")2. BOOL CTestgdiApp::InitInstance() GdiplusStartupInput m_gdiplusStartupInput; GdiplusStartup(&m_gdiplusToken, &m_gdiplusStartupInput, NULL); m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow();3. int CTestgdiApp::ExitInstance() { // TODO: Add your specialized code here and/or call the base class Gdiplus::GdiplusShutdown(m_gdiplusToken); return CWinApp::ExitInstance();}4. testgdiDlg.cpp : implementation file#include "stdafx.h"#include "testgdi.h"#include "testgdiDlg.h"#include "GdiPlus.h"#include <windows.h>#include <dshow.h>#include <stdio.h>#include <conio.h>#include <qedit.h> // SampleGrabber用#include <math.h>#include <windowsx.h>#include <mmsystem.h>#include <stdlib.h>#include <string.h>#include <limits.h>#include <ctype.h>//#include "cv.h"//#include "cxcore.h"#pragma comment(lib, "strmiids.lib") #pragma comment(lib, "gdiplus.lib")5. 运行程序--Bitmap bmp( L"a.bmp" );//Bitmap bmp2( bmp.getWidth(), bmp.getHeight() );Bitmap bmp2( 320, 240 );Graphics g(hMemDC);//Graphics g(hDC);g.DrawImage( &bmp, 0, 0 ); gdiplus.h,gdiplus.dll 都按照vc的规定设定完成.前面4点都是参考上网查的资料配置sdk,第5点就是试验一下vc 对话框的运行的正确与否.麻烦各位先进了. a.bmp 放在3个位置1. c:2. 原程序目录上.3. 和原程序的debug放在一起. 如果实在开发环境下执行,放在2路径,如果是在Debug下直接执行,放在3路径,你最好设定一个绝对路径。 HDC hdc,hMemDC;Bitmap bmp( L"a.bmp" );//Bitmap bmp2( bmp.getWidth(), bmp.getHeight() );Bitmap bmp2( 320, 240 );Graphics g(hMemDC);//Graphics g(hDC);g.DrawImage( &bmp, 0, 0 );各种路径都试过了,Bitmap bmp( L"c:\\a.bmp" );Bitmap bmp( L"c:\\test\\a.bmp" );Bitmap bmp( L"c:\\test\debug\\a.bmp" );我有点怀疑不一定是程序本身的问题,而是sdk配置还是不行,麻烦您贴一个如上面这样的简单程序,让我在我的机上运行一下,以证实问题出在哪.麻烦了.谢谢. 可以在内存中转的的,好像有一个libjpeg库可以拿过来用的! c++ 矩形与多边形的相交求结果,如何实现? windowless ATL 组件多线程资源释放问题 “串行化”的“行”的读音是什么? 讨论一下关于数据存储和数据搜索的问题 用WinInet类下载网页,如果地址是http://www.263.net我如何知道服务器上的网页名称?? 网站刚刚建好!高兴!散分!!!!! vc6.0和vc.net有什么区别? 高手,救命!!这是一个串行通信的问题!怎样关闭串口? classwizard信息文件*.clw读不了了怎么修来着的? 谁有关于串口操作的类? VC如何读取txt文件中的某几行 请问一个位图双缓冲的问题?
Graphics g( bmp2 );
g.DrawImage( &bmp, 0, 0 );SaveToJpg( bmp2 );// 需要自己写SaveToJpg,还需要GetEncoderClsid等函数,查找GDI+相关例子。
Image::Save(IStream*,CLSID*,EncoderParameters*)
按hellowithsmile
的提示运行,但没有显示;
请帮忙查看一下错在哪.1. StdAfx.h#define ULONG_PTR unsigned long
#include <Gdiplus.h>
using namespace Gdiplus;
//#define ULONG_PTR ULONG
//#include <gdiplus.h>
//using namespace Gdiplus;
#pragma comment(lib, "gdiplus.lib")2. BOOL CTestgdiApp::InitInstance() GdiplusStartupInput m_gdiplusStartupInput;
GdiplusStartup(&m_gdiplusToken, &m_gdiplusStartupInput, NULL);
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();3. int CTestgdiApp::ExitInstance()
{
// TODO: Add your specialized code here and/or call the base class
Gdiplus::GdiplusShutdown(m_gdiplusToken);
return CWinApp::ExitInstance();
}
4. testgdiDlg.cpp : implementation file
#include "stdafx.h"
#include "testgdi.h"
#include "testgdiDlg.h"
#include "GdiPlus.h"
#include <windows.h>
#include <dshow.h>
#include <stdio.h>
#include <conio.h>
#include <qedit.h> // SampleGrabber用
#include <math.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
//#include "cv.h"
//#include "cxcore.h"
#pragma comment(lib, "strmiids.lib")
#pragma comment(lib, "gdiplus.lib")
5. 运行程序--
Bitmap bmp( L"a.bmp" );
//Bitmap bmp2( bmp.getWidth(), bmp.getHeight() );
Bitmap bmp2( 320, 240 );
Graphics g(hMemDC);
//Graphics g(hDC);
g.DrawImage( &bmp, 0, 0 );
前面4点都是参考上网查的资料配置sdk,第5点就是试验一下
vc 对话框的运行的正确与否.麻烦各位先进了.
1. c:
2. 原程序目录上.
3. 和原程序的debug放在一起.
Bitmap bmp( L"a.bmp" );
//Bitmap bmp2( bmp.getWidth(), bmp.getHeight() );
Bitmap bmp2( 320, 240 );
Graphics g(hMemDC);
//Graphics g(hDC);
g.DrawImage( &bmp, 0, 0 );各种路径都试过了,Bitmap bmp( L"c:\\a.bmp" );
Bitmap bmp( L"c:\\test\\a.bmp" );
Bitmap bmp( L"c:\\test\debug\\a.bmp" );
我有点怀疑不一定是程序本身的问题,而是sdk配置还是不行
,麻烦您贴一个如上面这样的简单程序,让我在我的机上运行一下,
以证实问题出在哪.
麻烦了.谢谢.