Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Beginner question - how to save HBITMAP to jpg

Bob_s_
Beginner
642 Views

Hi.

Years ago i used the old IJL lib

I used:

ijlInit

ijlWrite

to convert bmp image to jpg



I am now trying the new IPP.

I work with Visual Studio C++ 2013 (i know - not supported yet but i can add the IPP include and lib folder to the project).

What i am trying to do is to capture screenshot of the desktop and have it in byte array.

So i do:

    HWND hDesktopWnd = GetDesktopWindow();

    HDC hDesktopDC = GetDC(hDesktopWnd);

    HDC hCaptureDC = CreateCompatibleDC(hDesktopDC);

    HBITMAP hCaptureBitmap = CreateCompatibleBitmap(hDesktopDC, iWidth, iHeight);

    SelectObject(hCaptureDC, hCaptureBitmap);

    

    BitBlt(hCaptureDC,0, 0, iWidth, iHeight, hDesktopDC, 0, 0, SRCCOPY | CAPTUREBLT);

    byte *bytPtr=NULL;

    SaveJPGToPtr(hCaptureBitmap, &bytPtr);

 

Now my question is how to write the SaveJPGToPtr function using IPP lib.

As its name says, SaveJPGToPtr gets the HBITMAP hCaptureBitmap handle and gets bytPtr.

When SaveJPGToPtr function returns,  bytPtr should points on the memory block of the jpg image.

So to sum - my goal is that in the end, bytPtr will point to a buffer that contains the desktop screenshots as JPG.

I will really appreciate if you will be able to help me to write the SaveJPGToPtr  function using the IPP lib.

If i will be able to do that easily as with the old  IJL then i will purchase the IPP on spot.



Please also let me know which .h files to exclude and which lib to link to.

 

Thanks!

 

 

 

0 Kudos
1 Reply
Sergey_K_Intel
Employee
642 Views

Hi Bob,

The IJL library, though it's a bit outdated, can be built with the recent IPP libraries. If you have source files for IJL, you can try. Capturing HBITMAP to JPEG is an application developer duty.

0 Kudos
Reply