# Convert cv::mat to gdi bitmap

**URL:** <https://forum.opencv.org/t/convert-cv-mat-to-gdi-bitmap/7324>\
**Category:** C++\
**Created:** [January 28, 2022, 8:27am UTC](https://forum.opencv.org/t/convert-cv-mat-to-gdi-bitmap/7324 "2022-01-28T08:27:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikomiko](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@mikomiko](https://forum.opencv.org/u/mikomiko)\
**Post date:** [January 28, 2022, 8:27am UTC](https://forum.opencv.org/t/convert-cv-mat-to-gdi-bitmap/7324/1 "2022-01-28T08:27:11Z")

</div>

While searching for a way to compress `GDI hbitmaps` to reduce their size in memory, I have found this topic about converting `cv::mat` to `GDI bitmap`:

> <https://stackoverflow.com/questions/24725155/opencv-tesseract-how-to-replace-libpng-libtiff-etc-with-gdi-bitmap-load-in>

I don’t have experience using `OpenCV`, suppose you ‘compress’ an image using `OpenCV` and then convert it to a `GDI bitmap`, at the end would this bitmap have the same size as a normal conversion just using `GDI bitmap` to `hbitmap`?
