- 1
Write a program to display the properties of a .bmp file?
1. File type 2. File size 3. Bits per resolution 4. Image height 5. Image width
6 ответов
+ 3
An other possibility of getting information from an image file is using a library like pillow. So you can get the properties without hassle.
+ 2
I did that recently. Like ~ swim ~ said, open the .bmp file in binary mode.
There are two headers :
- general header : bmp signature (BM), the file size, 4 bytes and the offset from beginning of the file where datas are stored. This header has a fixed size of 14 bytes.
- second header of unknown size : size of that header, then width and height of the image, then other informations about compression, number of bits per pixel and the size of the datas.
While reading the datas, be careful of the 4bytes alignment.
+ 2
Please avoid writing your question into the Relevant Tags section 👍
+ 2
~ swim ~
I promise I will keep trying to remind our new friends best I can, when and where I can. But I won't be doing it for a badge bro, I'm just so badly wanting to see the search bar does its work satisfactorily 😁
Tough work being a mod bro, you been there, besides I guess I'm more free as non mod anyway 😁