搜索
查看: 1576|回复: 1

使用 gdip.image ,发现不是都能获得DateTime信息

[复制链接]

2

主题

2

帖子

15

积分

新手入门

Rank: 1

积分
15
发表于 2018-2-12 10:19:07 | 显示全部楼层 |阅读模式
本帖最后由 codefish 于 2018-2-12 10:28 编辑

大家好,使用 gdip.image ,发现不是都能获得DateTime信息。
有的没有,但是windows下右键查看时可以看到的。
谢谢。

代码如下:
[0x0132]="DateTime"; 这个不是每个手机拍摄的jpg都能取到。其实是有的。

  1. //图像EXIF信息
  2. import console;
  3. import inet.http;
  4. import fsys.dlg;
  5. import gdip;

  6. var jpgPath = fsys.dlg.open("jpg图像文件|*.jpg||","请选择图像",fsys.getSpecial(0x27 /*_CSIDL_MYPICTURES*/) )
  7. if(!jpgPath) return;

  8. exifTags = {
  9. [0x0001]="GpsLatitudeRef";
  10. [0x0003]="GpsLongitudeRef";
  11. [0x0005]="GpsAltitudeRef";
  12. [0x0006]="GpsAltitude";
  13. [0x0007]="GpsGpsTime";
  14. [0x0008]="GpsGpsSatellites";
  15. [0x0009]="GpsGpsStatus";
  16. [0x000C]="GpsSpeedRef";
  17. [0x000D]="GpsSpeed";
  18. [0x000E]="GpsTrackRef";
  19. [0x0010]="GpsImgDirRef";
  20. [0x0013]="GpsDestLatRef";
  21. [0x0015]="GpsDestLongRef";
  22. [0x0017]="GpsDestBearRef";
  23. [0x0019]="GpsDestDistRef";
  24. [0x001A]="GpsDestDist";
  25. [0x00FE]="NewSubfileType";
  26. [0x00FF]="SubfileType";
  27. [0x0100]="ImageWidth";
  28. [0x0101]="ImageHeight";
  29. [0x0102]="BitsPerSample";
  30. [0x0103]="Compression";
  31. [0x0106]="PhotometricInterp";
  32. [0x0107]="ThreshHolding";
  33. [0x0108]="CellWidth";
  34. [0x0109]="CellHeight";
  35. [0x010A]="FillOrder";
  36. [0x010D]="DocumentName";
  37. [0x010E]="ImageDescription";
  38. [0x010F]="EquipMake";
  39. [0x0110]="EquipModel";
  40. [0x0111]="StripOffsets";
  41. [0x0112]="Orientation";
  42. [0x0115]="SamplesPerPixel";
  43. [0x0116]="RowsPerStrip";
  44. [0x0117]="StripBytesCount";
  45. [0x0118]="MinSampleValue";
  46. [0x0119]="MaxSampleValue";
  47. [0x011A]="XResolution";
  48. [0x011B]="YResolution";
  49. [0x011C]="PlanarConfig";
  50. [0x011D]="PageName";
  51. [0x011E]="XPosition";
  52. [0x011F]="YPosition";
  53. [0x0120]="FreeOffset";
  54. [0x0121]="FreeByteCounts";
  55. [0x0123]="GrayResponseCurve";
  56. [0x0128]="ResolutionUnit";
  57. [0x0129]="PageNumber";
  58. [0x012D]="TransferFunction";
  59. [0x0131]="SoftwareUsed";
  60. [0x0132]="DateTime";
  61. [0x013B]="Artist";
  62. [0x013C]="HostComputer";
  63. [0x013D]="Predictor";
  64. [0x013E]="WhitePoint";
  65. [0x013F]="PrimaryChromaticities";
  66. [0x0140]="ColorMap";
  67. [0x0141]="HalftoneHints";
  68. [0x0142]="TileWidth";
  69. [0x0143]="TileLength";
  70. [0x0144]="TileOffset";
  71. [0x0145]="TileByteCounts";
  72. [0x014C]="InkSet";
  73. [0x014D]="InkNames";
  74. [0x014E]="NumberOfInks";
  75. [0x0151]="SamplesPerPixel";
  76. [0x0152]="ExtraSamples";
  77. [0x0153]="SampleFormat";
  78. [0x0154]="SMinSampleValue";
  79. [0x0155]="SMaxSampleValue";
  80. [0x0156]="TransferRange";
  81. [0x0200]="JPEGProc";
  82. [0x0201]="JPEGInterFormat";
  83. [0x0202]="JPEGInterLength";
  84. [0x0203]="JPEGRestartInterval";
  85. [0x0205]="JPEGLosslessPredictors";
  86. [0x0206]="JPEGPointTransforms";
  87. [0x0207]="JPEGQTables";
  88. [0x0208]="JPEGDCTables";
  89. [0x0209]="JPEGACTables";
  90. [0x0211]="YCbCrCoefficients";
  91. [0x0212]="YCbCrSubsampling";
  92. [0x0213]="YCbCrPositioning";
  93. [0x0214]="REFBlackWhite";
  94. [0x0302]="ICCProfileDescriptor";
  95. [0x0303]="SRGBRenderingIntent";
  96. [0x0320]="ImageTitle";
  97. [0x5001]="ResolutionXUnit";
  98. [0x5002]="ResolutionYUnit";
  99. [0x5003]="ResolutionXLengthUnit";
  100. [0x5004]="ResolutionYLengthUnit";
  101. [0x5005]="PrintFlags";
  102. [0x5006]="PrintFlagsVersion";
  103. [0x5007]="PrintFlagsCrop";
  104. [0x5008]="PrintFlagsBleedWidth";
  105. [0x5009]="PrintFlagsBleedWidthScale";
  106. [0x500A]="HalftoneLPI";
  107. [0x500B]="HalftoneLPIUnit";
  108. [0x500C]="HalftoneDegree";
  109. [0x500D]="HalftoneShape";
  110. [0x500E]="HalftoneMisc";
  111. [0x500F]="HalftoneScreen";
  112. [0x5010]="JPEGQuality";
  113. [0x5011]="GridSize";
  114. [0x5012]="ThumbnailFormat";
  115. [0x5013]="ThumbnailWidth";
  116. [0x5014]="ThumbnailHeight";
  117. [0x5015]="ThumbnailColorDepth";
  118. [0x5016]="ThumbnailPlanes";
  119. [0x5017]="ThumbnailRawBytes";
  120. [0x5018]="ThumbnailSize";
  121. [0x5019]="ThumbnailCompressedSize";
  122. [0x501A]="ColorTransferFunction";
  123. [0x501B]="ThumbnailData";
  124. [0x5020]="ThumbnailImageWidth";
  125. [0x5021]="ThumbnailImageHeight";
  126. [0x5022]="ThumbnailBitsPerSample";
  127. [0x5023]="ThumbnailCompression";
  128. [0x5024]="ThumbnailPhotometricInterp";
  129. [0x5025]="ThumbnailImageDescription";
  130. [0x5026]="ThumbnailEquipMake";
  131. [0x5027]="ThumbnailEquipModel";
  132. [0x5028]="ThumbnailStripOffsets";
  133. [0x5029]="ThumbnailOrientation";
  134. [0x502A]="ThumbnailSamplesPerPixel";
  135. [0x502B]="ThumbnailRowsPerStrip";
  136. [0x502C]="ThumbnailStripBytesCount";
  137. [0x502D]="ThumbnailResolutionX";
  138. [0x502E]="ThumbnailResolutionY";
  139. [0x502F]="ThumbnailPlanarConfig";
  140. [0x5030]="ThumbnailResolutionUnit";
  141. [0x5031]="ThumbnailTransferFunction";
  142. [0x5032]="ThumbnailSoftwareUsed";
  143. [0x5033]="ThumbnailDateTime";
  144. [0x5034]="ThumbnailArtist";
  145. [0x5035]="ThumbnailWhitePoint";
  146. [0x5036]="ThumbnailPrimaryChromaticities";
  147. [0x5037]="ThumbnailYCbCrCoefficients";
  148. [0x5038]="ThumbnailYCbCrSubsampling";
  149. [0x5039]="ThumbnailYCbCrPositioning";
  150. [0x503A]="ThumbnailRefBlackWhite";
  151. [0x503B]="ThumbnailCopyRight";
  152. [0x5100]="FrameDelay";
  153. [0x5101]="LoopCount";
  154. [0x5102]="GlobalPalette";
  155. [0x5103]="IndexBackground";
  156. [0x5104]="IndexTransparent";
  157. [0x5110]="PixelUnit";
  158. [0x5111]="PixelPerUnitX";
  159. [0x5112]="PixelPerUnitY";
  160. [0x5113]="PaletteHistogram";
  161. [0x8298]="Copyright";
  162. [0x829A]="ExifExposureTime";
  163. [0x829D]="ExifFNumber";
  164. [0x8769]="ExifIFD";
  165. [0x8773]="ICCProfile";
  166. [0x8822]="ExifExposureProg";
  167. [0x8824]="ExifSpectralSense";
  168. [0x8825]="GpsIFD";
  169. [0x9101]="ExifCompConfig";
  170. [0x9102]="ExifCompBPP";
  171. [0x9201]="ExifShutterSpeed";
  172. [0x9202]="ExifAperture";
  173. [0x9206]="ExifSubjectDist";
  174. [0x9207]="ExifMeteringMode";
  175. [0x9208]="ExifLightSource";
  176. [0x927C]="ExifMakerNote";
  177. [0x9286]="ExifUserComment";
  178. [0x9290]="ExifDTSubsec";
  179. [0x9291]="ExifDTOrigSS";
  180. [0x9292]="ExifDTDigSS";
  181. [0xA002]="ExifPixXDim";
  182. [0xA003]="ExifPixYDim";
  183. [0xA005]="ExifInterop";
  184. [0xA20B]="ExifFlashEnergy";
  185. [0xA20E]="ExifFocalXRes";
  186. [0xA20F]="ExifFocalYRes";
  187. [0xA210]="ExifFocalResUnit";
  188. [0xA214]="ExifSubjectLoc";
  189. [0xA215]="ExifExposureIndex";
  190. [0xA217]="ExifSensingMethod";
  191. [0xA302]="ExifCfaPattern";
  192. }
  193.   
  194. var img = gdip.image(jpgPath)
  195. for( id,propertyItem in img.eachProperty() ){  
  196.         console.printf('0x%04x\t%s\t%s',id,exifTags[id]:"unknown", propertyItem.text  )
  197.         console.more( 10 )
  198. }

  199. execute("pause")
复制代码


回复

使用道具 举报

185

主题

2541

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
13974
发表于 2018-2-12 13:07:50 | 显示全部楼层
反馈BUG请提供有意义的信息,点右上角“BUG反馈”,
例如:你认为有问题的JPG图像文件,你认为不一致的信息对比截图。

任何文件,都有创建时间,这并不表示EXIF里就一定有。
Windows是一个操作系统,而gdip.image是一个图像类,功能不好直接拿来对比。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

手机版|未经许可严禁引用或转载本站文章|站长邮箱|aardio.com|aardio官方社区 ( 皖ICP备09012014号 )

GMT+8, 2018-12-17 01:03 , Processed in 0.062500 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表