小编joh*_*rdo的帖子

如何将经度和纬度转换为GPS Exif字节数组

我试图将纬度= 8°50'34.46"和经度= 125°9'50.82"放入图像的exif文件中.我正在使用vb.net.

我没有将度数和分钟转换为字节的问题,因为它是一个整数但是当我将具有十进制值的秒(34.46")转换为字节时.它给出了不同的结果,如0.9856.

请帮助我们如何将带有十进制值的数字转换为字节.

这里的代码:

Private Shared Function intToByteArray(ByVal int As Int32) As Byte()
    ' a necessary wrapper because of the cast to Int32
    Return BitConverter.GetBytes(int)
End Function

Private Shared Function doubleToByteArray(ByVal dbl As Double) As Byte()
    Return BitConverter.GetBytes(Convert.ToDecimal(dbl))
End Function

Private Shared Function doubleCoordinateToRationalByteArray(ByVal doubleVal As Double) As Byte()
    Dim temp As Double

    temp = Math.Abs(doubleVal)
    Dim degrees = Math.Truncate(temp)

    temp = (temp - degrees) * 60
    Dim minutes = Math.Truncate(temp)

    temp = (temp - minutes) * 60 …
Run Code Online (Sandbox Code Playgroud)

vb.net gps exif data-conversion

2
推荐指数
1
解决办法
1046
查看次数

标签 统计

data-conversion ×1

exif ×1

gps ×1

vb.net ×1