From HBITMAP, you can just use StretchBlt to divide it in 4 parts :
Splitting jpg image
Hi,
I need to split the jpg image into 4 images. Instead of splitting the image into 4 after creating single image, my requirement is I need to create 4 images by splitting bitmap bit data or hbitmap.
Is it possible to split bitmap bit data or hbitmap to create 4 images?
Is there any other way using win32 apis
Thanks
-
Castorix31 86,151 Reputation points
2021-02-05T09:03:40.967+00:00
2 additional answers
Sort by: Most helpful
-
Strive Sun-MSFT 426 Reputation points
2021-02-05T06:56:09.087+00:00 Hello, @abc abc
For jpg image, consider using WIC to get its handle.
Here is a sample,
How to Load a Bitmap from a File
After getting the handle of the picture, draw it to hdc, and use the BitBlt function for bit block transmission of color data. Just set the coordinates and size of the picture.
----------
Thank you!
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
-
Viorel 118.4K Reputation points
2021-02-05T08:08:28.123+00:00 If you already have the full image (HBITMAP), you can create a Bitmap object using Image::FromHbitmap, then you can extract a rectangle using Bitmap::Clone.