??? 08/18/10 06:36 Read: times |
#178070 - Embedded decode of BMP to text file??? Responding to: ???'s previous message |
1) This seems to be a PC program using Borland C. Why post such a question on an embedded forum, where the programs are intended for use in toasters, display signs, network switches, lamp timers etc? You just select a random forum without discrimination?
2) How easy do you think it is to read the source code, when you did not bother to use the "Insert Program Code" button? You never saw it, because you didn't look? 3) Why do you use pow()? Have you not found other ways to combine multiple bytes into a larger integer? 4) You ask about troubles handling 1-bit BMP files, but your code doesn't seem to have any code that cares about the number of colors in the file - except printing the header information. Have you even tried to make the code auto-detecting? 5) You have a loop like: for (j=0;j<col;j++) { for(k=0;k<row;k++) { for(i=0;i<3;i++) { fprintf(fp2,"%d",(int)extract(fp1,offset++,1)); fprintf(fp2," "); } fprintf(fp2," "); } fprintf(fp2,"n"); offset+=2; } A: Did you select the loop variables to be as little useful as possible? B: You seem to loop three color planes (i) - but what if the image file doesn't have 3 color planes? What happens if the image just have 256 shades of gray? C: You seem to read one byte per pixel and per color plane - but do you really think there is three full bytes for an image that has one single bit/pixel? D: You perform a seek for every single read you d - don't you expect that sequential data is stored sequentially in the file? Do you think seek() speeds up the file processing? |
Topic | Author | Date |
*.bmp file | 01/01/70 00:00 | |
Embedded decode of BMP to text file??? | 01/01/70 00:00 | |
.bmp to .c | 01/01/70 00:00 | |
A hexdump of a file does not need to know file format![]() | 01/01/70 00:00 |