明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1168|回复: 2

[函数] LISP怎么获取图片的拍摄日期?

[复制链接]
发表于 2013-9-8 23:33 | 显示全部楼层 |阅读模式

可能会用到的函数或参数信息
http://www.codeproject.com/Articles/3803/Cexif

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2013-9-9 21:33 | 显示全部楼层
我也想知道啊
 楼主| 发表于 2013-9-9 22:19 | 显示全部楼层


Private Type GdiplusStartupInput
    GdiplusVersion           As Long
    DebugEventCallback       As Long
    SuppressBackgroundThread As Long
    SuppressExternalCodecs   As Long
End Type


Private Type PropertyItem
   propId                   As Long               ' ID of this property
   Length                   As Long               ' Length of the property value, in bytes
   Type                     As Long                 ' Type of the value, as one of TAG_TYPE_XXX  defined above
   Value                    As Long                ' property value
End Type


Private Declare Function GdiplusStartup Lib "gdiplus" (Token As Long, inputbuf As GdiplusStartupInput, Optional ByVal outputbuf As Long = 0) As Long
Private Declare Sub GdiplusShutdown Lib "gdiplus" (ByVal Token As Long)
Private Declare Function GdipLoadImageFromFile Lib "gdiplus" (ByVal FileName As Long, hImage As Long) As Long
Private Declare Function GdipDisposeImage Lib "gdiplus" (ByVal Image As Long) As Long

Private Declare Function GdipGetPropertyCount Lib "gdiplus" (ByVal Image As Long, numOfProperty As Long) As Long
Private Declare Function GdipGetPropertyIdList Lib "gdiplus" (ByVal Image As Long, ByVal numOfProperty As Long, list As Long) As Long
Private Declare Function GdipGetPropertyItemSize Lib "gdiplus" (ByVal Image As Long, ByVal propId As Long, Size As Long) As Long
Private Declare Function GdipGetPropertyItem Lib "gdiplus" (ByVal Image As Long, ByVal propId As Long, ByVal propSize As Long, Buffer As Long) As Long
Private Declare Function GdipGetPropertySize Lib "gdiplus" (ByVal Image As Long, totalBufferSize As Long, numProperties As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpDst As Any, lpSrc As Any, ByVal ByteLength As Long)



Private Function GetPhotoDate(ImagePath As String) As String
    Dim Bitmap                  As Long
    Dim Token                   As Long
    Dim Index                   As Long
    Dim PropertyCount           As Long
    Dim ItemSize                As Long
    Dim Prop                    As PropertyItem
    Dim GdipInput               As GdiplusStartupInput
    Const PropertyTagExifDTOrig As Long = &H9003&                  ' Date & time of original

    GdipInput.GdiplusVersion = 1
    GdiplusStartup Token, GdipInput
    GdipLoadImageFromFile StrPtr(ImagePath), Bitmap
    GdipGetPropertyCount Bitmap, PropertyCount
    ReDim PropertyList(PropertyCount - 1) As Long
    GdipGetPropertyIdList Bitmap, PropertyCount, PropertyList(0)
    For Index = 0 To PropertyCount - 1
        GdipGetPropertyItemSize Bitmap, PropertyList(Index), ItemSize
        ReDim Buffer(ItemSize - 1) As Byte
        GdipGetPropertyItem Bitmap, PropertyList(Index), ItemSize, ByVal VarPtr(Buffer(0))
        CopyMemory Prop, ByVal VarPtr(Buffer(0)), Len(Prop)
        ReDim Data(ItemSize - 16) As Byte
        CopyMemory Data(0), ByVal Prop.Value, ItemSize - 16
        Select Case PropertyList(Index)
        Case PropertyTagExifDTOrig
            GetPhotoDate = StrConv(Data, vbUnicode)
        End Select
    Next
    GdipDisposeImage Bitmap
    GdiplusShutdown Token
End Function

这是网上查到的VB版,请高手转换为LISP咯
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-5 12:18 , Processed in 0.307294 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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