# Write and read a 1 bpp image using OpenCV / C++

**URL:** <https://forum.opencv.org/t/write-and-read-a-1-bpp-image-using-opencv-c/8442>\
**Category:** C++\
**Tags:** imgcodecs\
**Created:** [April 18, 2022, 2:19pm UTC](https://forum.opencv.org/t/write-and-read-a-1-bpp-image-using-opencv-c/8442 "2022-04-18T14:19:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pedro77](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@Pedro77](https://forum.opencv.org/u/Pedro77)\
**Post date:** [April 18, 2022, 2:19pm UTC](https://forum.opencv.org/t/write-and-read-a-1-bpp-image-using-opencv-c/8442/1 "2022-04-18T14:19:16Z")

</div>

How can I write (from 8bpp data), save it, and read (from file) a 1bpp image using OpenCV?

I’ve searched for it, there are some incomplete SO forum threads. I haven’t found a good solution to this.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [April 21, 2022, 2:45pm UTC](https://forum.opencv.org/t/write-and-read-a-1-bpp-image-using-opencv-c/8442/2 "2022-04-21T14:45:13Z")

</div>

can you explain, what you need this for ?

( opencv does not have any provision to save _bits_, the smallest unit here is a uchar (8 bits, a single grayscale pixel) )
