如何提取jpg文件的拍照时间? 非修改时间、创建时间属性 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 jpg文件有拍照时间吗?如果是手工画的另存为JPG的呢? 读取exif信息然后分析。但是要注意,并不是所有的jpeg文件都有exif内容的。比如用acdsee保存jpeg文件,就可以选择是否保留 exif 信息。有读取 exif 信息的开源代码,我在 sf.net 找到过两个。不过没测试!:-)贴其中的一个吧,仅一个类文件:==== 将下面的代码保存为 .cls 文件====VERSION 1.0 CLASSBEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObjectENDAttribute VB_Name = "ExifReader"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = TrueAttribute VB_PredeclaredId = FalseAttribute VB_Exposed = FalseAttribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"Attribute VB_Ext_KEY = "Top_Level" ,"Yes"Option ExplicitPrivate ExifTemp() As BytePrivate Offset_to_IFD0 As LongPrivate Offset_to_APP1 As LongPrivate Offset_to_TIFF As LongPrivate Length_of_APP1 As LongPrivate Offset_to_Next_IFD As LongPrivate IFDDirectory() As IFD_DataPrivate Offset_to_ExifSubIFD As LongPrivate m_Tag As LongPrivate m_file As StringPrivate IsLoaded As BooleanPrivate Enum EXIF_DATA_FORMAT m_BYTE = 1 m_STRING = 2 m_SHORT = 3 m_LONG = 4 m_RATIONAL = 5 m_SBYTE = 6 m_UNDEFINED = 7 m_SSHORT = 8 m_SLONG = 9 m_SRATIONAL = 10 m_SINGLE = 11 m_DOUBLE = 12End EnumPrivate Type IFD_Data_Values BytVal As Byte StrVal As String IntVal As Integer LngVal As Long SngVal As Single DblVal As DoubleEnd Type Private Type IFD_Data Tag_No As EXIF_TAG MakerNote As Boolean Data_Format As EXIF_DATA_FORMAT Components As Long Offset_To_Value As Long Value As VariantEnd TypePublic Enum EXIF_TAG 'IFD0 Tags ImageDescription = &H10E& Make = &H10F& Model = &H110& Orientation = &H112& XResolution = &H11A& YResolution = &H11B& ResolutionUnit = &H128& Software = &H131& DateTime = &H132& WhitePoint = &H13E& PrimaryChromaticities = &H13F& YCbCrCoefficients = &H211& YCbCrPositioning = &H213& ReferenceBlackWhite = &H214& Copyright = &H8298& ExifOffset = &H8769& 'ExifSubIFD Tags ExposureTime = &H829A& FNumber = &H829D& ExposureProgram = &H8822& ISOSpeedRatings = &H8827& ExifVersion = &H9000& DateTimeOriginal = &H9003& DateTimeDigitized = &H9004& ComponentsConfiguration = &H9101& CompressedBitsPerPixel = &H9102& ShutterSpeedValue = &H9201& ApertureValue = &H9202& BrightnessValue = &H9203& ExposureBiasValue = &H9204& MaxApertureValue = &H9205& SubjectDistance = &H9206& MeteringMode = &H9207& LightSource = &H9208& Flash = &H9209& FocalLength = &H920A& MakerNote = &H927C& UserComment = &H9286& SubsecTime = &H9290& SubsecTimeOriginal = &H9291& SubsecTimeDigitized = &H9292& FlashPixVersion = &HA000& ColorSpace = &HA001& ExifImageWidth = &HA002& ExifImageHeight = &HA003& RelatedSoundFile = &HA004& ExifInteroperabilityOffset = &HA005& FocalPlaneXResolution = &HA20E& FocalPlaneYResolution = &HA20F& FocalPlaneResolutionUnit = &HA210& ExposureIndex = &HA215& SensingMethod = &HA217& FileSource = &HA300& SceneType = &HA301& CFAPattern = &HA302& 'Interoperability IFD Tags InteroperabilityIndex = &H1& InteroperabilityVersion = &H2& RelatedImageFileFormat = &H1000& RelatedImageWidth = &H1001& RelatedImageLength = &H1002& 'IFD1 Tags ImageWidth = &H100& ImageHeight = &H101& BitsPerSample = &H102& Compression = &H103& PhotometricInterpretation = &H106& StripOffsets = &H111& SamplePerPixel = &H115& RowsPerStrip = &H116& StripByteCounts = &H117& XResolution2 = &H11A& YResolution2 = &H11B& PlanarConfiguration = &H11C& ResolutionUnit2 = &H128& JPEGInterchangeFormat = &H201& JPEGInterchangeFormatLength = &H202& YCbCrCoeffecients = &H211& YCbCrSubSampling = &H212& YCbCrPositioning2 = &H213& ReferenceBlackWhite2 = &H214& 'Misc Tags NewSubfileType = &HFE& SubfileType = &HFF& TransferFunction = &H12D& Artist = &H13B& Predictor = &H13D& TileWidth = &H142& TileLength = &H143& TileOffsets = &H144& TileByteCounts = &H145& SubIFDs = &H14A& JPEGTables = &H15B& CFARepeatPatternDim = &H828D& CFAPattern2 = &H828E& BatteryLevel = &H828F& IPTC_NAA = &H83BB& InterColorProfile = &H8773& SpectralSensitivity = &H8824& GPSInfo = &H8825& OECF = &H8828& Interlace = &H8829& TimeZoneOffset = &H882A& SelfTimerMode = &H882B& FlashEnergy = &H920B& SpatialFrequencyResponse = &H920C& Noise = &H920D& ImageNumber = &H9211& SecurityClassification = &H9212& ImageHistory = &H9213& SubjectLocation = &H9214& ExposureIndex2 = &H9215& TIFFEPStandardID = &H9216& FlashEnergy2 = &HA20B& SpatialFrequencyResponse2 = &HA20C& SubjectLocation2 = &HA214&End Enum(未完) 晕,代码太长,老贴不上。如果是你的要,留个 email 吧! debug.print可以显示却无法显示在text或label里的奇怪数据 VB 如何点击图片? 请问常用的API是哪些? VB怎样声明binkw32.dll 如果捕捉“点击任务栏图标事件" (初学) 求标准程序流程 ! 可用分没有了找谁? DataEnvironment怎样在运行时指定连接字串???? 怎样读取注册表中指定项目的键值?(在线等待) 作安装盘问题? 请教大家能使用变量做变量名吗? 关于ACCESS数据库的问题!!!!!!!1
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "ExifReader"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option ExplicitPrivate ExifTemp() As Byte
Private Offset_to_IFD0 As Long
Private Offset_to_APP1 As Long
Private Offset_to_TIFF As Long
Private Length_of_APP1 As Long
Private Offset_to_Next_IFD As Long
Private IFDDirectory() As IFD_Data
Private Offset_to_ExifSubIFD As Long
Private m_Tag As Long
Private m_file As String
Private IsLoaded As BooleanPrivate Enum EXIF_DATA_FORMAT
m_BYTE = 1
m_STRING = 2
m_SHORT = 3
m_LONG = 4
m_RATIONAL = 5
m_SBYTE = 6
m_UNDEFINED = 7
m_SSHORT = 8
m_SLONG = 9
m_SRATIONAL = 10
m_SINGLE = 11
m_DOUBLE = 12
End EnumPrivate Type IFD_Data_Values
BytVal As Byte
StrVal As String
IntVal As Integer
LngVal As Long
SngVal As Single
DblVal As Double
End Type
Private Type IFD_Data
Tag_No As EXIF_TAG
MakerNote As Boolean
Data_Format As EXIF_DATA_FORMAT
Components As Long
Offset_To_Value As Long
Value As Variant
End TypePublic Enum EXIF_TAG
'IFD0 Tags
ImageDescription = &H10E&
Make = &H10F&
Model = &H110&
Orientation = &H112&
XResolution = &H11A&
YResolution = &H11B&
ResolutionUnit = &H128&
Software = &H131&
DateTime = &H132&
WhitePoint = &H13E&
PrimaryChromaticities = &H13F&
YCbCrCoefficients = &H211&
YCbCrPositioning = &H213&
ReferenceBlackWhite = &H214&
Copyright = &H8298&
ExifOffset = &H8769&
'ExifSubIFD Tags
ExposureTime = &H829A&
FNumber = &H829D&
ExposureProgram = &H8822&
ISOSpeedRatings = &H8827&
ExifVersion = &H9000&
DateTimeOriginal = &H9003&
DateTimeDigitized = &H9004&
ComponentsConfiguration = &H9101&
CompressedBitsPerPixel = &H9102&
ShutterSpeedValue = &H9201&
ApertureValue = &H9202&
BrightnessValue = &H9203&
ExposureBiasValue = &H9204&
MaxApertureValue = &H9205&
SubjectDistance = &H9206&
MeteringMode = &H9207&
LightSource = &H9208&
Flash = &H9209&
FocalLength = &H920A&
MakerNote = &H927C&
UserComment = &H9286&
SubsecTime = &H9290&
SubsecTimeOriginal = &H9291&
SubsecTimeDigitized = &H9292&
FlashPixVersion = &HA000&
ColorSpace = &HA001&
ExifImageWidth = &HA002&
ExifImageHeight = &HA003&
RelatedSoundFile = &HA004&
ExifInteroperabilityOffset = &HA005&
FocalPlaneXResolution = &HA20E&
FocalPlaneYResolution = &HA20F&
FocalPlaneResolutionUnit = &HA210&
ExposureIndex = &HA215&
SensingMethod = &HA217&
FileSource = &HA300&
SceneType = &HA301&
CFAPattern = &HA302&
'Interoperability IFD Tags
InteroperabilityIndex = &H1&
InteroperabilityVersion = &H2&
RelatedImageFileFormat = &H1000&
RelatedImageWidth = &H1001&
RelatedImageLength = &H1002&
'IFD1 Tags
ImageWidth = &H100&
ImageHeight = &H101&
BitsPerSample = &H102&
Compression = &H103&
PhotometricInterpretation = &H106&
StripOffsets = &H111&
SamplePerPixel = &H115&
RowsPerStrip = &H116&
StripByteCounts = &H117&
XResolution2 = &H11A&
YResolution2 = &H11B&
PlanarConfiguration = &H11C&
ResolutionUnit2 = &H128&
JPEGInterchangeFormat = &H201&
JPEGInterchangeFormatLength = &H202&
YCbCrCoeffecients = &H211&
YCbCrSubSampling = &H212&
YCbCrPositioning2 = &H213&
ReferenceBlackWhite2 = &H214&
'Misc Tags
NewSubfileType = &HFE&
SubfileType = &HFF&
TransferFunction = &H12D&
Artist = &H13B&
Predictor = &H13D&
TileWidth = &H142&
TileLength = &H143&
TileOffsets = &H144&
TileByteCounts = &H145&
SubIFDs = &H14A&
JPEGTables = &H15B&
CFARepeatPatternDim = &H828D&
CFAPattern2 = &H828E&
BatteryLevel = &H828F&
IPTC_NAA = &H83BB&
InterColorProfile = &H8773&
SpectralSensitivity = &H8824&
GPSInfo = &H8825&
OECF = &H8828&
Interlace = &H8829&
TimeZoneOffset = &H882A&
SelfTimerMode = &H882B&
FlashEnergy = &H920B&
SpatialFrequencyResponse = &H920C&
Noise = &H920D&
ImageNumber = &H9211&
SecurityClassification = &H9212&
ImageHistory = &H9213&
SubjectLocation = &H9214&
ExposureIndex2 = &H9215&
TIFFEPStandardID = &H9216&
FlashEnergy2 = &HA20B&
SpatialFrequencyResponse2 = &HA20C&
SubjectLocation2 = &HA214&
End Enum(未完)