读取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

智能推荐

2014年高级计算机操作员工种代码36-323不可积分入户深圳吗,计算机操作员 (2011年深圳招调工热门工种)...-程序员宅基地

文章浏览阅读198次。好消息:计算机操作员(工种代码:46-207)被确定为2011年深圳市职业技能鉴定计算机类鉴定工种学习对象:Office2003综合应用:1、向有一定电脑基础,特别是对OFFICE办公软件有一定了解,欲从事计算机日常办公的人员进行培训.2、此科目是深圳市招调工种.图形图像处理CorelDraw X3:1、从事或有意从事工艺美术、广告艺术、图文排版、图文印刷、计算机多媒体技术工作人员以及其他需要掌握..._计算机操作员职业代码

文心一言api接入如何在你的项目里使用文心一言_文言一心api-程序员宅基地

文章浏览阅读7.5k次,点赞6次,收藏47次。基于百度文心一言语言大模型的智能文本对话AI机器人API,支持聊天对话、行业咨询、语言学习、代码编写等功能.您的AppKey和uid是重要信息,请务必妥善保存,避免泄漏!您的AppKey和uid是重要信息,请务必妥善保存,避免泄漏!您的AppKey和uid是重要信息,请务必妥善保存,避免泄漏!AppKey申请通过后,登录。请求方式: POST。_文言一心api

别再用硬编码写业务流程了,试试这款轻量级流程编排框架-程序员宅基地

文章浏览阅读488次。前言在每个公司的系统中,总有一些拥有复杂业务逻辑的系统,这些系统承载着核心业务逻辑,几乎每个需求都和这些核心业务有关,这些核心业务业务逻辑冗长,涉及内部逻辑运算,缓存操作,持久化操作,外部..._什么业务场景要用到编排工具

P1015 回文数_1、若一个5位数字从左向右读与从右向左读都一样,我们就将其称之为回文串。小申编-程序员宅基地

文章浏览阅读297次。题目描述若一个数(首位不为零)从左向右读与从右向左读都一样,我们就将其称之为回文数。例如:给定一个十进制数5656,将5656加6565(即把5656从右向左读),得到121121是一个回文数。又如:对于十进制数8787:STEP1:8787+7878=165165STEP2:165165+561561=726726STEP3:726726+627627=13531..._1、若一个5位数字从左向右读与从右向左读都一样,我们就将其称之为回文串。小申编

直线与球体的交点lisp_晓东CAD家园-论坛-A/VLISP-[LISP函数]:计算直线与曲线交点-:5 如何用Lisp程序计算支线Line与曲线(二次样条或PLINE拟合曲线)三交点,请诸位高手提...-程序员宅基地

文章浏览阅读389次。[font=courier new]86. xdrx_getinters功能:1.求两个AcDbCurve(曲线)实体的交点.2.求一个AcDbCurve(曲线)实体和一个选择集中所有AcDbCurve(曲线)的交点。3.求一个选择集中所有AcDbCurve(曲线)实体的交点.4.求一个选择集SS1中的所有AcDbCurve实体和另个选择集SS2所有AcDbCurve实体的交点。调用格式: 1. ..._lisp inters

HDU 1198 - Farm Irrigation-程序员宅基地

文章浏览阅读44次。Problem DescriptionBenny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipes are placed in these squares. Different square has...

随便推点

Axis2/c 知识点-程序员宅基地

文章浏览阅读145次。官网文档: http://axis.apache.org/axis2/c/core/docs/axis2c_manual.html从文档中可以总结出:1. Axis2/C是一个用C语言实现的Web Service引擎。Axis2/C基于Axis2架构,支持SOAP1.1和SOAP1.2协议,并且支持RESTful风格的Web Service。基于Axis2/C的Web Service可以..._axis2/c服务端调用axis2_get_instance

企业架构方法论-程序员宅基地

文章浏览阅读3k次。目前主要的两种架构方法(准确的说是方法论),具体的方法也是有的,也有可实际操作层面的东西,那要看很多的各个细分专业层面的东西。比如画流程图,业务流程图、数据流程图、系统交互流程图等等。togafzachmanzachman业务建模分析框架,相比于togaf,直观上直接提供了可操作的东西,可能大家更容易接受一些。这里推荐一个架构设计的专业工具,是免费的,即ArchMateArchi – Open Source ArchiMate Modelling (archim..._企业架构方法论

堆栈与队列的方法区分、优先队列的应用_判断是栈还是队列还是优先队列-程序员宅基地

文章浏览阅读123次。堆栈与队列具体的方法区分_判断是栈还是队列还是优先队列

上海计算机学会2021年7月月赛C++丙组T1布置会场-程序员宅基地

文章浏览阅读352次,点赞8次,收藏8次。小爱老师可以购买两份双拼花束后,将他重新组合成一束百合花+一束郁金香。已知布置会场需要用到x束百合花与y束郁金香,请问小爱老师购买花朵最少花费需多少元?输出共一行,一个正整数,表示小爱老师购买花朵最少花费需多少元。直接购买8束百合+6束郁金香,共计8*8+6*10=124元。内存限制: 256 Mb时间限制: 1000 ms。先购买12束双拼花朵,花费12*8=96元,第一行:两个正整数表示需要的花束数量x,y。第二行:三个正整数表示花束费用a,b,c。再购买2束百合花,花费2*8=16元,

python实现ping某一ip_使用Python测试Ping主机IP和某端口是否开放的实例-程序员宅基地

文章浏览阅读518次。使用Python方法比用各种命令方便,可以设置超时时间,到底通不通,端口是否开放一眼能看出来。命令和返回完整权限,可以ping通,端口开放,结果如下:无root权限(省略了ping),端口开放,结果如下:完整权限,可以ping通,远端端口关闭,结果如下:完整权限,可以ping通,本地端口关闭,结果如下:完整权限,不能ping通(端口自然也无法访问),结果如下:pnp.py代码#!/usr/bin/..._python ping ip无管理员权限

zplane函数怎么用m文件调用_matlab中cla用法-程序员宅基地

文章浏览阅读738次。零极点与系统稳定性的关系 4.状态方程含义 5.使用 zplane 函数 [实验原理] 该实验用 MATLAB 中库函数,如 tf2zp(b,a),ss2zp(A,B,C,D),zplane(z,p),......MATLAB 中相关命令 aa abs 绝对值、模、字符的 ascii 码值 a...零极点与系统稳定性的关系 4.状态方程含义 5.使用 zplane 函数 [实验原理] 该实验用 M..._matlabcla。m文件