Convert BMP to JPG
-
I am currently generating a BMP file by capturing screenshot of the current active window. Any ideas how to convert it to JPG format in order to make its size small. We are Ok with some loss occuring in image quality after the conversion. Thanks Cagespear
-
I am currently generating a BMP file by capturing screenshot of the current active window. Any ideas how to convert it to JPG format in order to make its size small. We are Ok with some loss occuring in image quality after the conversion. Thanks Cagespear
You may use
GDI+ Image
class to save it asJPEG
file [^]. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
[my articles] -
I am currently generating a BMP file by capturing screenshot of the current active window. Any ideas how to convert it to JPG format in order to make its size small. We are Ok with some loss occuring in image quality after the conversion. Thanks Cagespear
#include <atlimage.h>
...
CImage CapturedBitmap;
CapturedBitmap.Create(width, height, 24);HDC BitmapDC = CapturedBitmap.GetDC();
...blt the window/screen pixels to BitmapDC ...
CapturedBitmap.ReleaseDC();
CapturedBitmap.Save(_T("c:\\myjpeg.jpg"), ImageFormatJPEG);
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
#include <atlimage.h>
...
CImage CapturedBitmap;
CapturedBitmap.Create(width, height, 24);HDC BitmapDC = CapturedBitmap.GetDC();
...blt the window/screen pixels to BitmapDC ...
CapturedBitmap.ReleaseDC();
CapturedBitmap.Save(_T("c:\\myjpeg.jpg"), ImageFormatJPEG);
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
If you handle of it you can use of CImage m_Image; m_Image.Attach(hbitmap); m_Image.Save("c:\\1.jpg");