读取JPG图片的Exif属性(二) - C代码实现_exif解析 c语言-程序员宅基地

技术标签: jpg  Exif  C++  图片  图像知识  GPS  

读区Exif属性简介

        读取Exif基本上就是在懂得Exif的格式的基础上,详细见上文: 

读取JPG图片的Exif属性 - Exif信息简介

然后就是对图片的数据进行字节分析了。这个分析也是非常重要的,就是一个一个字节来分析图片的Exif属性,一般这段字节就是图片的开始部分。可以使用 工具将JPG图片按照16进制的格式打开,然后在对着图片来分析。

        由于国内关于此部分的讲述非常少,我在国外的一个网站上找到一个简单的读取Exif属性的实例,下面就是关于这个demo自己做的一些修改和理解。

如下是一个实际图片的16进制数据:
FF D8 FF E0 00 10 4A 46 49 46 00 01 02 01 00 60
00 60   00 00 FF E1 08 32 45 78 69 66 00 00 49 49

  DecodeExif 函数主要是获取到Eixf属性在图片数据中入口地址:

第一次执行 DecodeExif 中的for(;;)读取的是section FF E0 M_JFIF
 FF D8       SOI
 FF E0       APP0
 00 10      APP0 LENGTH = 16

FF D8 FF E0  00 10 4A 46 49 46 00 01 02 01 00 60
00 60   00 00 FF E1 08 32 45 78 69 66 00 00 49 49
蓝色部分就是读取的长度16个字节。

第二次次执行 DecodeExif 中的for(;;)读取的是section FF E0 M_JFIF

FF D8 FF E0  00 10 4A 46 49 46 00 01 02 01 00 60
00 60   00 00  FF E1  08 32  45 78 69 66 00 00  49 49

FF E1      APP1
  08 32      APP0 LENGTH = 08 32 = 2098
45 78 69 66   "Exif" 字符 
也就是代码: if ( memcmp ( Data + 2 , "Exif" , 4 ) == 0 )所定义那样,获取四个字符,
从FF E1开始 长度为2098 个字节。
m_exifinfo -> IsExif = process_EXIF (( unsigned char *) Data + 2 , itemlen );
从这个函数开始,分析Exif各种属性,也就是 获取到Eixf属性在图片数据中入口地址以及Exif所占的长度
   
   
    
  1. bool Cexif::DecodeExif(FILE * hFile)
  2. {
  3. int a;
  4. int HaveCom = 0;
  5. a = fgetc(hFile);
  6. if (a != 0xff || fgetc(hFile) != M_SOI){
  7. return 0;
  8. }
  9. for(;;){
  10. int itemlen;
  11. int marker = 0;
  12. int ll,lh, got;
  13. unsigned char * Data;
  14. if (SectionsRead >= MAX_SECTIONS){
  15. strcpy(m_szLastError,"Too many sections in jpg file");
  16. return 0;
  17. }
  18. for (a=0;a<7;a++){
  19. marker = fgetc(hFile);
  20. if (marker != 0xff) break;
  21. if (a >= 6){
  22. printf("too many padding unsigned chars\n");
  23. return 0;
  24. }
  25. }
  26. if (marker == 0xff){
  27. // 0xff is legal padding, but if we get that many, something's wrong.
  28. strcpy(m_szLastError,"too many padding unsigned chars!");
  29. return 0;
  30. }
  31. Sections[SectionsRead].Type = marker;
  32. // Read the length of the section.
  33. lh = fgetc(hFile);
  34. ll = fgetc(hFile);
  35. itemlen = (lh << 8) | ll;
  36. if (itemlen < 2){
  37. strcpy(m_szLastError,"invalid marker");
  38. return 0;
  39. }
  40. Sections[SectionsRead].Size = itemlen;
  41. Data = (unsigned char *)malloc(itemlen);
  42. if (Data == NULL){
  43. strcpy(m_szLastError,"Could not allocate memory");
  44. return 0;
  45. }
  46. Sections[SectionsRead].Data = Data;
  47. // Store first two pre-read unsigned chars.
  48. Data[0] = (unsigned char)lh;
  49. Data[1] = (unsigned char)ll;
  50. got = fread(Data+2, 1, itemlen-2,hFile); // Read the whole section.
  51. if (got != itemlen-2){
  52. strcpy(m_szLastError,"Premature end of file?");
  53. return 0;
  54. }
  55. SectionsRead += 1;
  56. switch(marker){
  57. case M_SOS: // stop before hitting compressed data
  58. // If reading entire image is requested, read the rest of the data.
  59. /*if (ReadMode & READ_IMAGE){
  60. int cp, ep, size;
  61. // Determine how much file is left.
  62. cp = ftell(infile);
  63. fseek(infile, 0, SEEK_END);
  64. ep = ftell(infile);
  65. fseek(infile, cp, SEEK_SET);
  66. size = ep-cp;
  67. Data = (uchar *)malloc(size);
  68. if (Data == NULL){
  69. strcpy(m_szLastError,"could not allocate data for entire image");
  70. return 0;
  71. }
  72. got = fread(Data, 1, size, infile);
  73. if (got != size){
  74. strcpy(m_szLastError,"could not read the rest of the image");
  75. return 0;
  76. }
  77. Sections[SectionsRead].Data = Data;
  78. Sections[SectionsRead].Size = size;
  79. Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER;
  80. SectionsRead ++;
  81. HaveAll = 1;
  82. }*/
  83. return 1;
  84. case M_EOI: // in case it's a tables-only JPEG stream
  85. printf("No image in jpeg!\n");
  86. return 0;
  87. case M_COM: // Comment section
  88. if (HaveCom){
  89. // Discard this section.
  90. free(Sections[--SectionsRead].Data);
  91. Sections[SectionsRead].Data=0;
  92. }else{
  93. process_COM(Data, itemlen);
  94. HaveCom = 1;
  95. }
  96. break;
  97. case M_JFIF:
  98. // Regular jpegs always have this tag, exif images have the exif
  99. // marker instead, althogh ACDsee will write images with both markers.
  100. // this program will re-create this marker on absence of exif marker.
  101. // hence no need to keep the copy from the file.
  102. free(Sections[--SectionsRead].Data);
  103. Sections[SectionsRead].Data=0;
  104. break;
  105. case M_EXIF:
  106. // Seen files from some 'U-lead' software with Vivitar scanner
  107. // that uses marker 31 for non exif stuff. Thus make sure
  108. // it says 'Exif' in the section before treating it as exif.
  109. if (memcmp(Data+2, "Exif", 4) == 0){
  110. m_exifinfo->IsExif = process_EXIF((unsigned char *)Data+2, itemlen);
  111. }else{
  112. // Discard this section.
  113. free(Sections[--SectionsRead].Data);
  114. Sections[SectionsRead].Data=0;
  115. }
  116. break;
  117. case M_SOF0:
  118. case M_SOF1:
  119. case M_SOF2:
  120. case M_SOF3:
  121. case M_SOF5:
  122. case M_SOF6:
  123. case M_SOF7:
  124. case M_SOF9:
  125. case M_SOF10:
  126. case M_SOF11:
  127. case M_SOF13:
  128. case M_SOF14:
  129. case M_SOF15:
  130. process_SOFn(Data, marker);
  131. break;
  132. default:
  133. // Skip any other sections.
  134. //if (ShowTags) printf("Jpeg section marker 0x%02x size %d\n",marker, itemlen);
  135. break;
  136. }
  137. }
  138. return 1;
  139. }

粗略分析Exif属性

FF D8 FF E0  00 10 4A 46 49 46 00 01 02 01 00 60
00 60   00 00   FF E1   08 32  45 78 69 66  00 00  49 49
2A 00  08 00 00 00   0B 00 0F 01 02 00 05 00 00 00
A2 00 00 00 10 01   02 00 20 00 00 00 A8 00 00 00
process_EXIF 
主要是对Exif属性做一个前期的处理,为了进一步详细的分析做处理。
由于EXIF是一种可交换的文件格式,所以可以用在Intel系列和Motorola系列的CPU上(至于两者CPU的区别,大家可以到网上找找,这里不做说明)。在文件中有一个标志,如果是“MM”表示Motorola的CPU,否则为“II”表示Intel的CPU。
  49 49   表示的是小端,小端的时候要格外注意其取字符的时候是从后往前取,才能获得正确的数据。
  4D 4D   表示的是大端
2A 00  表示的是 检查下面 2 个字节是否是 0x2A00
08 00 00 00  判断下面的 0th IFD Offset 是否是 0x08000000

    
    
     
  1. /*--------------------------------------------------------------------------
  2. Process a EXIF marker
  3. Describes all the drivel that most digital cameras include...
  4. --------------------------------------------------------------------------*/
  5. bool Cexif::process_EXIF(unsigned char * CharBuf, unsigned int length)
  6. {
  7. m_exifinfo->FlashUsed = 0;
  8. /* If it's from a digicam, and it used flash, it says so. */
  9. m_exifinfo->Comments[0] = '\0'; /* Initial value - null string */
  10. ExifImageWidth = 0;
  11. { /* Check the EXIF header component */
  12. static const unsigned char ExifHeader[] = "Exif\0\0";
  13. if (memcmp(CharBuf+0, ExifHeader,6)){
  14. strcpy(m_szLastError,"Incorrect Exif header");
  15. return 0;
  16. }
  17. }
  18. if (memcmp(CharBuf+6,"II",2) == 0){
  19. MotorolaOrder = 0;
  20. }else{
  21. if (memcmp(CharBuf+6,"MM",2) == 0){
  22. MotorolaOrder = 1;
  23. }else{
  24. strcpy(m_szLastError,"Invalid Exif alignment marker.");
  25. return 0;
  26. }
  27. }
  28. /* Check the next two values for correctness. */
  29. if (Get16u(CharBuf+8) != 0x2a){
  30. strcpy(m_szLastError,"Invalid Exif start (1)");
  31. return 0;
  32. }
  33. int FirstOffset = Get32u(CharBuf+10);
  34. if (FirstOffset < 8 || FirstOffset > 16){
  35. // I used to ensure this was set to 8 (website I used indicated its 8)
  36. // but PENTAX Optio 230 has it set differently, and uses it as offset. (Sept 11 2002)
  37. strcpy(m_szLastError,"Suspicious offset of first IFD value");
  38. return 0;
  39. }
  40. unsigned char * LastExifRefd = CharBuf;
  41. /* First directory starts 16 unsigned chars in. Offsets start at 8 unsigned chars in. */
  42. if (!ProcessExifDir(CharBuf+14, CharBuf+6, length-6, m_exifinfo, &LastExifRefd))
  43. return 0;
  44. /* This is how far the interesting (non thumbnail) part of the exif went. */
  45. // int ExifSettingsLength = LastExifRefd - CharBuf;
  46. /* Compute the CCD width, in milimeters. */
  47. if (m_exifinfo->FocalplaneXRes != 0){
  48. m_exifinfo->CCDWidth = (float)(ExifImageWidth * m_exifinfo->FocalplaneUnits / m_exifinfo->FocalplaneXRes);
  49. }
  50. return 1;
  51. }

详细分析Exif属性

FF D8 FF E0  00 10 4A 46 49 46 00 01 02 01 00 60
00 60   00 00   FF E1   08 32  45 78 69 66  00 00  49 49
2A 00  08 00 00 00    0B 00 0F 01 02 00 05 00 00 00
A2 00 00 00 10 01   02 00 20 00 00 00 A8 00 00 00

0B 00   Tag总共的数量,12个, 00 0B, 所以下面就主要围绕这个12个tag来寻找其属性
一个tag的格式就是:
Tag 类型名
Format: 格式,tag TYPE
count:    最多的字符个数为
offset: 偏移量,但是这里的偏移量要记得加上从(II    49 49 )+1D

按照第一个实例:

                                            0F 01  02 00  05 00 00 00
A2 00 00 00 10 01   02 00 20 00 00 00 A8 00 00 00

Tag   0F 01      TAG Image input equipment manuf 
Format: 格式,  02 00, 格式为2
count:     05 00 00 00  为5
offset: 偏移量, A2 00 00 00   +1D    ,需要移动到 C0
* LastExifRefdP = ValuePtr + BytesCount ; 获取获得数据的 46 4C 49 52  

一次类推获得相关的tag数据,都是这样获得。关于GPS信息的话,且听下回分解。
    
    
     
  1. /*--------------------------------------------------------------------------
  2. Process one of the nested EXIF directories.
  3. --------------------------------------------------------------------------*/
  4. bool Cexif::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength,
  5. EXIFINFO * const m_exifinfo, unsigned char ** const LastExifRefdP )
  6. {
  7. int de;
  8. int a;
  9. int NumDirEntries;
  10. unsigned ThumbnailOffset = 0;
  11. unsigned ThumbnailSize = 0;
  12. NumDirEntries = Get16u(DirStart);
  13. if ((DirStart+2+NumDirEntries*12) > (OffsetBase+ExifLength)){
  14. strcpy(m_szLastError,"Illegally sized directory");
  15. return 0;
  16. }
  17. for (de=0;de<NumDirEntries;de++){
  18. int Tag, Format, Components;
  19. unsigned char * ValuePtr;
  20. /* This actually can point to a variety of things; it must be
  21. cast to other types when used. But we use it as a unsigned char-by-unsigned char
  22. cursor, so we declare it as a pointer to a generic unsigned char here.
  23. */
  24. int BytesCount;
  25. unsigned char * DirEntry;
  26. DirEntry = DirStart+2+12*de;
  27. Tag = Get16u(DirEntry);
  28. Format = Get16u(DirEntry+2);
  29. Components = Get32u(DirEntry+4);
  30. if ((Format-1) >= NUM_FORMATS) {
  31. /* (-1) catches illegal zero case as unsigned underflows to positive large */
  32. strcpy(m_szLastError,"Illegal format code in EXIF dir");
  33. return 0;
  34. }
  35. BytesCount = Components * BytesPerFormat[Format];
  36. if (BytesCount > 4){
  37. unsigned OffsetVal;
  38. OffsetVal = Get32u(DirEntry+8);
  39. /* If its bigger than 4 unsigned chars, the dir entry contains an offset.*/
  40. if (OffsetVal+BytesCount > ExifLength){
  41. /* Bogus pointer offset and / or unsigned charcount value */
  42. strcpy(m_szLastError,"Illegal pointer offset value in EXIF.");
  43. return 0;
  44. }
  45. ValuePtr = OffsetBase+OffsetVal;
  46. }else{
  47. /* 4 unsigned chars or less and value is in the dir entry itself */
  48. ValuePtr = DirEntry+8;
  49. }
  50. if (*LastExifRefdP < ValuePtr+BytesCount){
  51. /* Keep track of last unsigned char in the exif header that was
  52. actually referenced. That way, we know where the
  53. discardable thumbnail data begins.
  54. */
  55. *LastExifRefdP = ValuePtr+BytesCount;
  56. }
  57. /* Extract useful components of tag */
  58. switch(Tag){
  59. case TAG_MAKE:
  60. strncpy(m_exifinfo->CameraMake, (char*)ValuePtr, 31);
  61. break;
  62. case TAG_MODEL:
  63. strncpy(m_exifinfo->CameraModel, (char*)ValuePtr, 39);
  64. break;
  65. case TAG_EXIF_VERSION:
  66. strncpy(m_exifinfo->Version,(char*)ValuePtr, 4);
  67. break;
  68. case TAG_DATETIME_ORIGINAL:
  69. strncpy(m_exifinfo->DateTime, (char*)ValuePtr, 19);
  70. break;
  71. case TAG_USERCOMMENT:
  72. // Olympus has this padded with trailing spaces. Remove these first.
  73. for (a=BytesCount;;){
  74. a--;
  75. if (((char*)ValuePtr)[a] == ' '){
  76. ((char*)ValuePtr)[a] = '\0';
  77. }else{
  78. break;
  79. }
  80. if (a == 0) break;
  81. }
  82. /* Copy the comment */
  83. if (memcmp(ValuePtr, "ASCII",5) == 0){
  84. for (a=5;a<10;a++){
  85. char c;
  86. c = ((char*)ValuePtr)[a];
  87. if (c != '\0' && c != ' '){
  88. strncpy(m_exifinfo->Comments, (char*)ValuePtr+a, 199);
  89. break;
  90. }
  91. }
  92. }else{
  93. strncpy(m_exifinfo->Comments, (char*)ValuePtr, 199);
  94. }
  95. break;
  96. case TAG_FNUMBER:
  97. /* Simplest way of expressing aperture, so I trust it the most.
  98. (overwrite previously computd value if there is one)
  99. */
  100. m_exifinfo->ApertureFNumber = (float)ConvertAnyFormat(ValuePtr, Format);
  101. break;
  102. case TAG_APERTURE:
  103. case TAG_MAXAPERTURE:
  104. /* More relevant info always comes earlier, so only
  105. use this field if we don't have appropriate aperture
  106. information yet.
  107. */
  108. if (m_exifinfo->ApertureFNumber == 0){
  109. m_exifinfo->ApertureFNumber = (float)exp(ConvertAnyFormat(ValuePtr, Format)*log(2)*0.5);
  110. }
  111. break;
  112. case TAG_BRIGHTNESS:
  113. m_exifinfo->Brightness = (float)ConvertAnyFormat(ValuePtr, Format);
  114. break;
  115. case TAG_FOCALLENGTH:
  116. /* Nice digital cameras actually save the focal length
  117. as a function of how farthey are zoomed in.
  118. */
  119. m_exifinfo->FocalLength = (float)ConvertAnyFormat(ValuePtr, Format);
  120. break;
  121. case TAG_SUBJECT_DISTANCE:
  122. /* Inidcates the distacne the autofocus camera is focused to.
  123. Tends to be less accurate as distance increases.
  124. */
  125. m_exifinfo->Distance = (float)ConvertAnyFormat(ValuePtr, Format);
  126. break;
  127. case TAG_EXPOSURETIME:
  128. /* Simplest way of expressing exposure time, so I
  129. trust it most. (overwrite previously computd value
  130. if there is one)
  131. */
  132. m_exifinfo->ExposureTime =
  133. (float)ConvertAnyFormat(ValuePtr, Format);
  134. break;
  135. case TAG_SHUTTERSPEED:
  136. /* More complicated way of expressing exposure time,
  137. so only use this value if we don't already have it
  138. from somewhere else.
  139. */
  140. if (m_exifinfo->ExposureTime == 0){
  141. m_exifinfo->ExposureTime = (float)
  142. (1/exp(ConvertAnyFormat(ValuePtr, Format)*log(2)));
  143. }
  144. break;
  145. case TAG_FLASH:
  146. if ((int)ConvertAnyFormat(ValuePtr, Format) & 7){
  147. m_exifinfo->FlashUsed = 1;
  148. }else{
  149. m_exifinfo->FlashUsed = 0;
  150. }
  151. break;
  152. case TAG_ORIENTATION:
  153. m_exifinfo->Orientation = (int)ConvertAnyFormat(ValuePtr, Format);
  154. if (m_exifinfo->Orientation < 1 || m_exifinfo->Orientation > 8){
  155. strcpy(m_szLastError,"Undefined rotation value");
  156. m_exifinfo->Orientation = 0;
  157. }
  158. break;
  159. case TAG_EXIF_IMAGELENGTH:
  160. case TAG_EXIF_IMAGEWIDTH:
  161. /* Use largest of height and width to deal with images
  162. that have been rotated to portrait format.
  163. */
  164. a = (int)ConvertAnyFormat(ValuePtr, Format);
  165. if (ExifImageWidth < a) ExifImageWidth = a;
  166. break;
  167. case TAG_FOCALPLANEXRES:
  168. m_exifinfo->FocalplaneXRes = (float)ConvertAnyFormat(ValuePtr, Format);
  169. break;
  170. case TAG_FOCALPLANEYRES:
  171. m_exifinfo->FocalplaneYRes = (float)ConvertAnyFormat(ValuePtr, Format);
  172. break;
  173. case TAG_RESOLUTIONUNIT:
  174. switch((int)ConvertAnyFormat(ValuePtr, Format)){
  175. case 1: m_exifinfo->ResolutionUnit = 1.0f; break; /* 1 inch */
  176. case 2: m_exifinfo->ResolutionUnit = 1.0f; break;
  177. case 3: m_exifinfo->ResolutionUnit = 0.3937007874f; break; /* 1 centimeter*/
  178. case 4: m_exifinfo->ResolutionUnit = 0.03937007874f; break; /* 1 millimeter*/
  179. case 5: m_exifinfo->ResolutionUnit = 0.00003937007874f; /* 1 micrometer*/
  180. }
  181. break;
  182. case TAG_FOCALPLANEUNITS:
  183. switch((int)ConvertAnyFormat(ValuePtr, Format)){
  184. case 1: m_exifinfo->FocalplaneUnits = 1.0f; break; /* 1 inch */
  185. case 2: m_exifinfo->FocalplaneUnits = 1.0f; break;
  186. case 3: m_exifinfo->FocalplaneUnits = 0.3937007874f; break; /* 1 centimeter*/
  187. case 4: m_exifinfo->FocalplaneUnits = 0.03937007874f; break; /* 1 millimeter*/
  188. case 5: m_exifinfo->FocalplaneUnits = 0.00003937007874f; /* 1 micrometer*/
  189. }
  190. break;
  191. // Remaining cases contributed by: Volker C. Schoech <schoech(at)gmx(dot)de>
  192. case TAG_EXPOSURE_BIAS:
  193. m_exifinfo->ExposureBias = (float) ConvertAnyFormat(ValuePtr, Format);
  194. break;
  195. case TAG_WHITEBALANCE:
  196. m_exifinfo->Whitebalance = (int)ConvertAnyFormat(ValuePtr, Format);
  197. break;
  198. case TAG_METERING_MODE:
  199. m_exifinfo->MeteringMode = (int)ConvertAnyFormat(ValuePtr, Format);
  200. break;
  201. case TAG_EXPOSURE_PROGRAM:
  202. m_exifinfo->ExposureProgram = (int)ConvertAnyFormat(ValuePtr, Format);
  203. break;
  204. case TAG_ISO_EQUIVALENT:
  205. m_exifinfo->ISOequivalent = (int)ConvertAnyFormat(ValuePtr, Format);
  206. if ( m_exifinfo->ISOequivalent < 50 ) m_exifinfo->ISOequivalent *= 200;
  207. break;
  208. case TAG_COMPRESSION_LEVEL:
  209. m_exifinfo->CompressionLevel = (int)ConvertAnyFormat(ValuePtr, Format);
  210. break;
  211. case TAG_XRESOLUTION:
  212. m_exifinfo->Xresolution = (float)ConvertAnyFormat(ValuePtr, Format);
  213. break;
  214. case TAG_YRESOLUTION:
  215. m_exifinfo->Yresolution = (float)ConvertAnyFormat(ValuePtr, Format);
  216. break;
  217. case TAG_THUMBNAIL_OFFSET:
  218. ThumbnailOffset = (unsigned)ConvertAnyFormat(ValuePtr, Format);
  219. break;
  220. case TAG_THUMBNAIL_LENGTH:
  221. ThumbnailSize = (unsigned)ConvertAnyFormat(ValuePtr, Format);
  222. break;
  223. }
  224. if (Tag == TAG_EXIF_OFFSET || Tag == TAG_INTEROP_OFFSET){
  225. unsigned char * SubdirStart;
  226. SubdirStart = OffsetBase + Get32u(ValuePtr);
  227. if (SubdirStart < OffsetBase ||
  228. SubdirStart > OffsetBase+ExifLength){
  229. strcpy(m_szLastError,"Illegal subdirectory link");
  230. return 0;
  231. }
  232. ProcessExifDir(SubdirStart, OffsetBase, ExifLength, m_exifinfo, LastExifRefdP);
  233. continue;
  234. }
  235. }
  236. {
  237. /* In addition to linking to subdirectories via exif tags,
  238. there's also a potential link to another directory at the end
  239. of each directory. This has got to be the result of a
  240. committee!
  241. */
  242. unsigned char * SubdirStart;
  243. unsigned Offset;
  244. Offset = Get16u(DirStart+2+12*NumDirEntries);
  245. if (Offset){
  246. SubdirStart = OffsetBase + Offset;
  247. if (SubdirStart < OffsetBase
  248. || SubdirStart > OffsetBase+ExifLength){
  249. strcpy(m_szLastError,"Illegal subdirectory link");
  250. return 0;
  251. }
  252. ProcessExifDir(SubdirStart, OffsetBase, ExifLength, m_exifinfo, LastExifRefdP);
  253. }
  254. }
  255. if (ThumbnailSize && ThumbnailOffset){
  256. if (ThumbnailSize + ThumbnailOffset <= ExifLength){
  257. /* The thumbnail pointer appears to be valid. Store it. */
  258. m_exifinfo->ThumbnailPointer = OffsetBase + ThumbnailOffset;
  259. m_exifinfo->ThumbnailSize = ThumbnailSize;
  260. }
  261. }
  262. return 1;
  263. }

Demo最终实现的结果


参考文档






版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/fioletfly/article/details/54094940

智能推荐

尚硅谷_谷粒学苑-微服务+全栈在线教育实战项目之旅_基于微服务的在线教育平台尚硅谷-程序员宅基地

文章浏览阅读2.7k次,点赞3次,收藏11次。SpringBoot+Maven+MabatisPlusmaven在新建springboot项目引入RELEASE版本出错maven在新建springboot项目引入RELEASE版本出错maven详解maven就是通过pom.xml中的配置,就能够从仓库获取到想要的jar包。仓库分为:本地仓库、第三方仓库(私服)、中央仓库springframework.boot:spring-boot-starter-parent:2.2.1.RELEASE’ not found若出现jar包下载不了只有两_基于微服务的在线教育平台尚硅谷

java 实现 数据库备份_java数据备份-程序员宅基地

文章浏览阅读1k次。数据库备份的方法第一种:使用mysqldump结合exec函数进行数据库备份操作。第二种:使用php+mysql+header函数进行数据库备份和下载操作。下面 java 实现数据库备份的方法就是第一种首先我们得知道一些mysqldump的数据库备份语句备份一个数据库格式:mysqldump -h主机名 -P端口 -u用户名 -p密码 --database 数据库名 ..._java数据备份

window10_ffmpeg调试环境搭建-编译64位_win10如何使用mingw64编译ffmpeg-程序员宅基地

文章浏览阅读3.4k次,点赞2次,收藏14次。window10_ffmpeg调试环境搭建_win10如何使用mingw64编译ffmpeg

《考试脑科学》_考试脑科学pdf百度网盘下载-程序员宅基地

文章浏览阅读6.3k次,点赞9次,收藏14次。给大家推荐《考试脑科学》这本书。作者介绍:池谷裕二,日本东京大学药学系研究科教授,脑科学研究者。1970年生于日本静冈县,1998年取得日本东京大学药学博士学位,2002年起担任美国哥伦比亚大学客座研究员。专业为神经科学与药理学,研究领域为人脑海马体与大脑皮质层的可塑性。现为东京大学药学研究所教授,同时担任日本脑信息通信融合研究中心研究主任,日本药理学会学术评议员、ERATO人脑与AI融合项目负责人。2008年获得日本文部大臣表彰青年科学家奖,2013年获得日本学士院学术奖励奖。这本书作者用非常通俗易懂_考试脑科学pdf百度网盘下载

今天给大家介绍一下华为智选手机与华为手机的区别_华为智选手机和华为手机的区别-程序员宅基地

文章浏览阅读1.4k次。其中,成都鼎桥通信技术有限公司是一家专业从事移动通讯终端产品研发和生产的高科技企业,其发布的TD Tech M40也是华为智选手机系列中的重要代表之一。华为智选手机是由华为品牌方与其他公司合作推出的手机产品,虽然其机身上没有“华为”标识,但是其品质和技术水平都是由华为来保证的。总之,华为智选手机是由华为品牌方和其他公司合作推出的手机产品,虽然外观上没有“华为”标识,但其品质和技术水平都是由华为来保证的。华为智选手机采用了多种处理器品牌,以满足不同用户的需求,同时也可以享受到华为全国联保的服务。_华为智选手机和华为手机的区别

c++求n个数中的最大值_n个数中最大的那个数在哪里?输出其位置,若有多个最大数则都要输出。-程序员宅基地

文章浏览阅读7.6k次,点赞6次,收藏17次。目录题目描述输入输出代码打擂法数组排序任意输入n个整数,把它们的最大值求出来.输入只有一行,包括一个整数n(1_n个数中最大的那个数在哪里?输出其位置,若有多个最大数则都要输出。

随便推点

Linux常用命令_ls-lmore-程序员宅基地

文章浏览阅读4.8k次,点赞17次,收藏51次。Linux的命令有几百个,对程序员来说,常用的并不多,考虑各位是初学者,先学习本章节前15个命令就可以了,其它的命令以后用到的时候再学习。1、开机 物理机服务器,按下电源开关,就像windows开机一样。 在VMware中点击“开启此虚拟机”。2、登录 启动完成后,输入用户名和密码,一般情况下,不要用root用户..._ls-lmore

MySQL基础命令_mysql -u user-程序员宅基地

文章浏览阅读4.1k次。1.登录MYSQL系统命令打开DOS命令框shengfen,以管理员的身份运行命令1:mysql -u usernae -p password命令2:mysql -u username -p password -h 需要连接的mysql主机名(localhost本地主机名)或是mysql的ip地址(默认为:127.0.0.1)-P 端口号(默认:3306端口)使用其中任意一个就OK,输入命令后DOS命令框得到mysql>就说明已经进入了mysql系统2. 查看mysql当中的._mysql -u user

LVS+Keepalived使用总结_this is the redundant configuration for lvs + keep-程序员宅基地

文章浏览阅读484次。一、lvs简介和推荐阅读的资料二、lvs和keepalived的安装三、LVS VS/DR模式搭建四、LVS VS/TUN模式搭建五、LVS VS/NAT模式搭建六、keepalived多种real server健康检测实例七、lvs持久性工作原理和配置八、lvs数据监控九、lvs+keepalived故障排除一、LVS简介和推荐阅读的资料 学习LVS+Keepalived必须阅读的三个文档。1、 《Keepalived权威指南》下载见http://..._this is the redundant configuration for lvs + keepalived server itself

Android面试官,面试时总喜欢挖基础坑,整理了26道面试题牢固你基础!(3)-程序员宅基地

文章浏览阅读795次,点赞20次,收藏15次。AIDL是使用bind机制来工作。java原生参数Stringparcelablelist & map 元素 需要支持AIDL其实Android开发的知识点就那么多,面试问来问去还是那么点东西。所以面试没有其他的诀窍,只看你对这些知识点准备的充分程度。so,出去面试时先看看自己复习到了哪个阶段就好。下图是我进阶学习所积累的历年腾讯、头条、阿里、美团、字节跳动等公司2019-2021年的高频面试题,博主还把这些技术点整理成了视频和PDF(实际上比预期多花了不少精力),包含知识脉络 + 诸多细节。

机器学习-数学基础02补充_李孟_新浪博客-程序员宅基地

文章浏览阅读248次。承接:数据基础02

短沟道效应 & 窄宽度效应 short channel effects & narrow width effects-程序员宅基地

文章浏览阅读2.8w次,点赞14次,收藏88次。文章目录1. 概念:Narrow Width Effect: 窄宽度效应Short Channel effects:短沟道效应阈值电压 (Threshold voltage)2. 阈值电压与沟道长和沟道宽的关系:Narrow channel 窄沟的分析Short channel 短沟的分析1. 概念:Narrow Width Effect: 窄宽度效应在CMOS器件工艺中,器件的阈值电压Vth 随着沟道宽度的变窄而增大,即窄宽度效应;目前,由于浅沟道隔离工艺的应用,器件的阈值电压 Vth 随着沟道宽度_短沟道效应