Reputation: 55
I recently wrote a program using C which takes a very simple Spice Netlist (txt-file) as an input and draws a BMP-File (uncompressed) according to the netlist.
The size of each component drawn is 100x51 pixels. So the output BMP-File will always have a fixed height of 51 pixels but the length is variable.
My question: How can I find out what the maximum length of the BMP-File is? It seems to work fine for dimensions over 32kx51, stops working correctly around 70kx51.
Here is the BMP Infoheader:
typedef struct
{
uint32_t bi_Size_;
int32_t bi_Width_;
int32_t bi_Height_;
uint16_t bi_Planes_;
uint16_t bi_Bit_Count_;
uint32_t bi_Compression_;
uint32_t bi_Size_Image_;
int32_t bi_X_Pels_Per_Meter_;
int32_t bi_Y_Pels_Per_Meter_;
uint32_t bi_Clr_Used_;
uint32_t bi_Clr_Important_;
}__attribute__((__packed__)) BitMapInfoHeader;
Upvotes: 0
Views: 894
Reputation: 2765
Depends on the actual BMP format, in 'classic' BMP width and height are stored in 16bit fields, so you can't have images larger than 65535x65535 pixels. This was later extended to 32bit values, but depending on the library you use to generate BMP it may only support the "classic" format or you may explicitly have to request a newer BMP variant to be created ...
See also e.g.:
http://en.wikipedia.org/wiki/BMP_file_format
Upvotes: 4