# Saved bmp files have incorrect dimensions

**URL:** <https://forums.openmv.io/t/saved-bmp-files-have-incorrect-dimensions/2145>\
**Category:** OpenMV Boards\
**Created:** [January 25, 2021, 11:02pm UTC](https://forums.openmv.io/t/saved-bmp-files-have-incorrect-dimensions/2145 "2021-01-25T23:02:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tam045](https://avatars.discourse-cdn.com/v4/letter/t/ccd318/32.png) [@tam045](https://forums.openmv.io/u/tam045)\
**Post date:** [January 25, 2021, 11:02pm UTC](https://forums.openmv.io/t/saved-bmp-files-have-incorrect-dimensions/2145/1 "2021-01-25T23:02:21Z")

</div>

Hello! I just got the OpenMV and am starting to use it.  
I’m trying to save snapshots from the OpenMV camera as 150x150 pixel size .bmp images. When I check the sizing of the .bmp file in the hex code of its header, it says that the width = 150 pixels , but the height is 106 pixels. I tried saving a snapshot as a .jpg file and then converting it to a .bmp file with an online converter, and the dimensions are 150 x 150 as expected. Is there something wrong with how I’m saving the .bmp file? Using the .jpg → .bmp conversion workaround isn’t ideal because I’d like to be able to send these .bmp files from the OpenMV to a different H7 board down the line.

Here’s the code I’m using:

```python
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) 
sensor.set_framesize(sensor.VGA) 
# check the sensor resolution width/height
print("Sensor width = ", sensor.width(), "; Sensor height = ", sensor.height())
sensor.set_windowing((120,140,150,150))
sensor.skip_frames(time = 2000) # Let new settings take affect.
pyb.LED(RED_LED_PIN).on()
sensor.skip_frames(time = 3000) # Give the user 3 seconds to get ready.
pyb.LED(RED_LED_PIN).off()
pyb.LED(BLUE_LED_PIN).on()
print("You're on camera!")
sensor.snapshot().save("wo8.bmp") # Save Pic.

```

I’ve attached 2 images of the hex code. One was saved directly from the openMV code, and the other I converted from jpg to bmp.

Thanks so much for any help!

 ![hex_data_convert_jpg_to_bmp.jpg](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/2X/9/957803e518f5c8fb8f998f755067051592983d59.jpeg)  
 ![hex_data_saved_direct_frm_openMV.jpg](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/2X/e/ead2aed7257b7a04cb5b81614e8fdc77b5f67c6c.jpeg)

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [January 25, 2021, 11:26pm UTC](https://forums.openmv.io/t/saved-bmp-files-have-incorrect-dimensions/2145/2 "2021-01-25T23:26:39Z")

</div>

Which OpenMV is that ? Also please include all the firmware info you see in the IDE when connected to the camera.

---

<div class="post-metadata">

**Author:** ![tam045](https://avatars.discourse-cdn.com/v4/letter/t/ccd318/32.png) [@tam045](https://forums.openmv.io/u/tam045)\
**Post date:** [January 25, 2021, 11:41pm UTC](https://forums.openmv.io/t/saved-bmp-files-have-incorrect-dimensions/2145/3 "2021-01-25T23:41:10Z")

</div>

Sorry about that! It’s the H7 OpenMV, with the OV7725 and FW version 3.8.0. Please let me know if there’s any other info I should give.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [January 25, 2021, 11:54pm UTC](https://forums.openmv.io/t/saved-bmp-files-have-incorrect-dimensions/2145/4 "2021-01-25T23:54:49Z")

</div>

The height is negative:

> <https://github.com/openmv/openmv/blob/master/src/omv/imlib/bmp.c#L219>

We save it like this so that it’s vertically flipped. So, the 16-bit height var is negative.

To note: BMP files start from the bottom up, not top down. So, storing the height as negative is common.

FF6A is negative 150.
