BMP image not saved as BMP file
I'm grabbing an image from the camera in PIXFORMAT_RGB888 and FRAMESIZE_UXGA which makes it 1600x1200.
The call to esp_camera_fb_get() returns without error and I successfully save it to a file on the SD card with .BMP as the file extension.
I move the SD card over to my computer and bring the file up in Windows Explorer. The preview plane in Windows Explorer shows the picture and it looks to be about the right size image, i.e. about 1600X1200. But I see that the actual size of the file is only about 48KB. How can that be? A bitmap image of that size should be around 5.5 MEGABYTES!! ??
I bring the file up in my paint program and it opens up just fine. It shows that the image size is indeed 1600X1200. I use the program's "Save As" function to save it out as a new file and select to do it in the BMP format (even though it ought to already be in that format). It does the save, and when I look at that newly saved file in Windows Explorer it has a size of about 5.5 MEGABYTES, which is what I had expected of the original image file.
I go back to Windows Explorer and change the extension of the original file from BMP to JPG and then open that newly-named file in my paint program. It opens and displays just fine, still showing the 1600X1200 image. It SEEMS that my paint program doesn't bother to look at the extension on the file name but rather opens up the file and figures out from some header data what the format is.
MY CONCLUSION
Even though I selected to have the ESP32-CAM camera create an image at PIXFORMAT_RGB888 and FRAMESIZE_UXGA, what it actually created was a PIXFORMAT_JPEG image.
WHAT?? WHY?? HOW??
And how do I get it to actually grab the image in PIXFORMAT_RGB888?
I had initially come across notes on various forums that the "best way" to get a bitmap version is to first grab a JPG version and use the JPG-to-BMP function. But my attempts at doing that showed that it only worked for really small images and caused memory allocation failures for medium and large images. I concluded that the problem was that the ESP32-CAM didn't have enough memory to hold BOTH the original PIXFORMAT_JPEG image AND the intended PIXFORMAT_RGB888.
That's when I resorted to trying to simply grab the image initially in the PIXFORMAT_RGB888 (which would seem to be the most sensible approach and not have to do some JPGtoBMP conversion). And it SEEMED to work, even at the maximum image size. But then I realized it wasn't actually in the PIXFORMAT_RGB888 but rather in the PIXFORMAT_JPEG!!
Why is it defaulting to PIXFORMAT_JPEG when I specifically tell it I want PIXFORMAT_RGB888. Why doesn't it, at the very least, TELL ME, via a posting out to the serial monitor, that it's doing that?
WHY NOT ENOUGH MEMORY
And I have to wonder why the ESP32-CAM wasn't built to have enough memory to handle any and all combinations of PIXFORMATs and FRAMESIZEs.
BMP image not saved as BMP file
-
- Posts: 21
- Joined: Mon Sep 14, 2020 1:21 am
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- 全国大学生物联网设计竞赛乐鑫答疑专区
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- 中文文档讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: No registered users and 19 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.