Tama?o de la imagen en bytes:-1209676666 $ b $bResoluciónhorizo​​ntal:0 $ b $bResoluciónvertical :0 Tama?o de la paleta:0 Colores importantes:0printf("\n Resolución horizontal: %d \n",bmp1->HorzResolution);printf("\n Resolución vertical: %d \n",bmp1->VertResolution);printf("\n Tama?o de la paleta: %d \n",bmp1->ColorsUsed);printf("\n Colores importantes: %d \n\n",bmp1->ColorsImportant);unsigned char *puntero=malloc(sizeof(uc)*((bmp1->SizeOfBitmap)*3));FILE *fout;fout=fopen("2.bmp","wb");fwrite(bmp1,sizeof(struct bmp),1,fout);fclose(fin);fclose(fout);free(puntero);};__________________________________________Console Result>>Propiedades de la imagen__________________________________________________ ____________Tipo de fichero: 19778 ***** (this is BM, its ok)Tama?o del fichero en bytes: -1208460616 ******** ( ???)Zona reservada: 6944 ********* ( ??? )Zona reservada: 47097Offset hasta el mapa de bits:-1209676762Tama?o de la cabecera: -1209347184Ancho de la imagen: -1209676730Altura de la imagen: -1209676714Número de planos: 52326Bits por pixel: 47077Compresión: -1209676682Tama?o de la imagen en bytes: -1209676666Resolución horizontal: 0Resolución vertical: 0Tama?o de la paleta: 0Colores importantes: 0推荐答案 如果你声明一个结构并将它变成它可能会匹配,它可能不匹配。 /> 它也将在不同的编译器上中断。 处理二进制文件格式的方法是声明以字节为单位加载 字段的函数从流中重新组装它们。例如图像 宽度是32位整数,我认为是小端。 将整个读取包装成一个函数。可能你只想要图像 尺寸和栅格数据。但是你可能不希望微软使用bgr-padding 格式,并且没有理由你应该返回 那个订单中的栅格。 - 免费游戏和编程好东西。 http://www.personal.leeds.ac.uk/~bgy1mmIf you declare a structure and fred it it might match up and it might not.It will also break on a different compiler.The way to treat a binary file format is to declare functions that load thefields byte by byte from the stream and reassemble them. For instance imagewidth is a 32 bit integer, I think little-endian.Wrap up the entire read into one function. Probably you only want imagedimensions and raster data. However you might not want the bgr-paddingformat Microsoft use, and there is no reason you should return the raster inthat order.--Free games and programming goodies. http://www.personal.leeds.ac.uk/~bgy1mm 我使用gcc ..所以..你认为最好是按成员阅读它的成员 或有什么东西可以解决它? 谢谢I use gcc.. so.. do you think its better to read it member by memberor there is something to fix it?Thanks 这篇关于读Bmp的问题..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-24 10:54