问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

VB中如何提取图片的exif信息?

发布网友 发布时间:2022-05-06 16:45

我来回答

2个回答

热心网友 时间:2022-04-23 10:01

估计要自己来解释文件,打开文件读取exif区段内容,按exif格式定义提取相关信息。参考这个来做,http://ke.baidu.com/view/182380.htm,应该不会太难。

热心网友 时间:2022-04-23 11:19

参考这个代码,请勿追问
Dim Offset_to_IFD0
Dim Offset_to_APP0
Dim Offset_to_APP1
Dim Offset_to_TIFF
Dim Offset_to_SOS
Dim Length_of_APP0
Dim Length_of_APP1
Dim Offset_to_Next_IFD
Dim IFDDirectory
IFDDirectory = Array(0)
Dim Offset_to_ExifSubIFD
Dim ImageFile
Dim IsLoaded
Dim ExifTemp
ExifTemp = Array(0)
Const IFD_IDX_Tag_No = 0
Const IFD_IDX_Tag_Name = 1
Const IFD_IDX_Data_Format = 2
Const IFD_IDX_Components = 3
Const IFD_IDX_Value = 4
Const IFD_IDX_Value_Desc = 5
Const IFD_IDX_OffsetToValue = 6
Function LookupExifTag(which)
Dim item
For Each item In ExifLookup
If ExifLookup(item) = which Then
LookupExifTag = item
Exit Function
End If
Next
LookupExifTag = which
End Function
Function GetExifByName(ExifTag)
If IsLoaded = False And ImageFile <> "" Then
LoadImage (ImageFile)
ElseIf IsLoaded = False And ImageFile = "" Then
Exit Function
End If
Dim i
For i = 0 To UBound(IFDDirectory) - 1
If IFDDirectory(i)(IFD_IDX_Tag_Name) = ExifTag Then
GetExifByName = IFDDirectory(i)(IFD_IDX_Value)
Exit For
End If
Next
End Function
Sub LoadImage(picFile)
If ImageFile = "" Then
ImageFile = picFile
If ImageFile = "" Then
Exit Sub
End If
End If
OpenJPGFile ImageFile
If InspectJPGFile = False Then
IsLoaded = False
Exit Sub
End If
If IsIntel Then
Offset_to_IFD0 = _
HexToDec(ExifTemp(Offset_to_APP1 + 17)) * 256 * 256 * 256 + _
HexToDec(ExifTemp(Offset_to_APP1 + 16)) * 256 * 256 + _
HexToDec(ExifTemp(Offset_to_APP1 + 15)) * 256 + _
HexToDec(ExifTemp(Offset_to_APP1 + 14))
Else
Offset_to_IFD0 = _
HexToDec(ExifTemp(Offset_to_APP1 + 14)) * 256 * 256 * 256 + _
HexToDec(ExifTemp(Offset_to_APP1 + 15)) * 256 * 256 + _
HexToDec(ExifTemp(Offset_to_APP1 + 16)) * 256 + _
HexToDec(ExifTemp(Offset_to_APP1 + 17))
End If
'Debug.Print "Offset_to_IFD0: " & Offset_to_IFD0
IsLoaded = True
GetDirectoryEntries Offset_to_TIFF + Offset_to_IFD0
MakeSenseOfMeaninglessValues
End Sub
Function InspectJPGFile()
Dim i
If ExifTemp(0) <> "FF" And ExifTemp(1) <> "D8" Then
InspectJPGFile = False
Else
For i = 2 To UBound(ExifTemp) - 1
If ExifTemp(i) = "FF" And ExifTemp(i + 1) = "E0" Then
Offset_to_APP0 = i
Exit For
End If
Next
If Offset_to_APP0 = 0 Then
InspectJPGFile = False
End If
Length_of_APP0 = _
HexToDec(ExifTemp(Offset_to_APP0 + 2)) * 256 + _
HexToDec(ExifTemp(Offset_to_APP0 + 3))
For i = 2 To UBound(ExifTemp) - 1
If ExifTemp(i) = "FF" And ExifTemp(i + 1) = "E1" Then
Offset_to_APP1 = i
Exit For
End If
Next
If Offset_to_APP1 = 0 Then
InspectJPGFile = False
End If
Offset_to_TIFF = Offset_to_APP1 + 10
Length_of_APP1 = _
HexToDec(ExifTemp(Offset_to_APP1 + 2)) * 256 + _
HexToDec(ExifTemp(Offset_to_APP1 + 3))
If Chr(HexToDec(ExifTemp(Offset_to_APP1 + 4))) & Chr(HexToDec(ExifTemp(Offset_to_APP1 + 5))) & _
Chr(HexToDec(ExifTemp(Offset_to_APP1 + 6))) & Chr(HexToDec(ExifTemp(Offset_to_APP1 + 7))) <> "Exif" Then
InspectJPGFile = False
Exit Function
End If
InspectJPGFile = True
End If
End Function
Function IsIntel()
If ExifTemp(Offset_to_TIFF) = "49" Then
IsIntel = True
Else
IsIntel = False
End If
End Function
Function writeExifToJPG(ExifData, FileName)
Dim FSO, FSO2, File, i
'Const adTypeBinary = 1
'Const adTypeText = 2
'Const adSaveCreateOverWrite = 2
If IsLoaded = False And ImageFile <> "" Then
LoadImage (ImageFile)
ElseIf IsLoaded = False And ImageFile = "" Then
Exit Function
End If
'Create Stream object
'Dim BinaryStream
'Set BinaryStream = CreateObject("ADODB.Stream")
'Specify stream type - we want To save binary data.
'BinaryStream.Type = adTypeBinary
'Open the stream And write binary data To the object
'BinaryStream.Open
'BinaryStream.Write ByteArray
Set FSO = CreateObject("Scripting.FileSystemObject")
'Create text stream object
Dim TextStream
Set TextStream = FSO.CreateTextFile(FileName & ".TMP")
For i = 0 To (Offset_to_APP0 + 2 + Length_of_APP0 - 1)
TextStream.Write Hex2Ascii(ExifTemp(i))
Next
TextStream.Write Hex2Ascii(ExifData)
For i = (Offset_to_APP0 + 2 + Length_of_APP0) To UBound(ExifTemp)
TextStream.Write Hex2Ascii(ExifTemp(i))
Next
Set FSO2 = Server.CreateObject("Scripting.FileSystemObject")
If FSO2.FileExists(FileName) Then
Set File = FSO2.OpenTextFile(FileName, ForReading, False, TristateFalse)
i = 0
While Not File.AtEndOfStream
If i > UBound(ExifTemp) Then
'BinaryStream.Write File.Read(1)
TextStream.Write File.Read(1)
End If
i = i + 1
Wend
File.Close
Set File = Nothing
Else
Response.Write ("File does not exist")
End If
Set FSO2 = Nothing
Set FSO = Nothing
'Save binary data To disk
'BinaryStream.SaveToFile FileName & ".TMP", adSaveCreateOverWrite
End Function
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
如何在手机百度上删除对话记录? 结核病是什么样的疾病? 曹丕17岁得了肺痨,明知自己命不长久,还要强争王位,是不是很自私呢?_百... 古代小说常出现的病名 急求一篇"生活小窍门"(500字)的作文 至今最有什么小妙招 健康的戒烟方法 笔记本电池锁死是什么原因引起的? 黑龙江债权转让合同纠纷该怎样取证 安徽债权转让合同纠纷应该怎么样取证 50分收集一句生日祝福语!急急急!有文采的人进! 新车玻璃上的贴纸怎么去除 php exif_read_data处理图片的大小限制 汽车玻璃上长时间的塑料贴纸怎么去除 圣诞节酒吧祝福语 如何获得PS(Photoshop)过的图片的EXIF 信息? 农民频道十月初三帮大哥去南宫果照村 帮大哥什么时候去南宫敢大集 换了以前的微信好友怎么找回来? 手机上如何确定专升本报名成功 PHP上传图片时,如何exif_read_data获取exif 南宫市民意通托欠工人工资怎么办? 把微信好友删除了!我怎么找回他的微信!没有记住,也没有手机号? 帮大哥来南宫宋家事 把微信好友删除了!我怎么找回他的微信!没有记住,也没有手机号? 大年初一发给老公的祝福语 求祝词! 语文学科新年祝福语 bl文,里面有4个兄弟还是5个!貌似是孤儿,名字分别有东方南宫西门北堂吧,反正最小的最呆! 怎么专升本报名? 求教! 用exif_read_data()直接读取相片的EXIF 信息,输出结果如下,该怎么解决啊! 曲阜市公交k0l路路线图 php 通过exif_read_data读取GPS信息后计算出不正常的经纬度 PHP 提示undefined function: exif_read_data() ,是怎么回事? 三乡到江门蓬江区长发里一号怎样坐公交车? 把微信好友删除了!我怎么找回他的微信!没有记住,也没有手机号 想知道: 武汉市 K01公交线路的信息? php上传图片时能不能指定EXIF参数? 如何在vc中实现jpeg文件的显示和exif的读取 exif 中的IFD是什么意思? 怎样查看照片是否经过PS ZOJ 1057 水题~ 在编译器上正确输出 为啥一提交就WA~~坐等大人解答~ 洋钱罐借款,有个36%的年综合资金成本,是什么意思,是要我多还36%吗? 被催收人员发信息到通讯录里的朋友侮辱家人是不是可以起诉 安可电脑重要性 大华继显有实力吗 大华继显(香港)有限公司怎么样? 沈阳大华继显科技有限公司怎么样? 2011江苏社会考生体育兼报普通类的体育什么时候考? zoj 1205, 一道水题,但是总是WA,求解? 题目地址:http:&#47;&#47;acm.zju.edu.cn&#47;onlinejudge&#47;showProblem.do?p