Click here to Skip to main content
15,908,634 members

Comments by Jozi68 (Top 8 by date)

Jozi68 8-Mar-12 13:46pm View    
15 years ago I would have written a small DLL that accepts x,y coordinates, and returns the color of whatever it finds at that position. Then I simply would have called this DLL from my VB6 application.
Today I don't know where to start...
Jozi68 8-Mar-12 13:05pm View    
Thank you OriginalGriff. It works if I click on the form; it returns the background color of the form.
What I actually need is to supply the x,y coordinates, and then get the color. This must be ouside the application, e.g on a photo that is open in Paint.
Jozi68 3-Mar-12 14:48pm View    
Thanx for the reply.
What does tag it mean?
What is WPF?
Where does the system.drawing command go?
When I said set-by-step, I meant step-by-step
Jozi68 9-Feb-11 5:52am View    
I think I got it right. Code is pasted below. However, I don't know how to interpret the altitude. I get an answer of 56844, and it should be: 1386.439.
Also, my string is being concatenated, I'm not sure why.

[ Dim byte_property_id As Byte()
Dim EorW As String
Dim NorS As String
Dim prop_type As String
Dim TheImageUsed As System.Drawing.Bitmap
Dim PropertyIDarray() As Integer
Dim TheProperty As Integer
Dim counter As Integer
Dim degrees As Double
Dim minutes As Double
Dim seconds As Double
Dim Altitude As Double
Dim LAT As String
Dim LON As String

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim TheString As String

TheString = readProps("c:\tmp\IMG_0090_____test.jpg")

MsgBox(TheString)

End Sub

Public Function readProps(ByVal TheJPG As String) As String

Dim TheString As String

TheImageUsed = New System.Drawing.Bitmap(TheJPG)
PropertyIDarray = TheImageUsed.PropertyIdList
For Each Me.TheProperty In PropertyIDarray
counter = counter + 1
byte_property_id = TheImageUsed.GetPropertyItem(TheProperty).Value
prop_type = TheImageUsed.GetPropertyItem(TheProperty).Type
If TheProperty = 1 Then
'Latitude North or South
NorS = System.Text.Encoding.ASCII.GetString(byte_property_id)
ElseIf TheProperty = 2 Then
'Latitude degrees minutes and seconds (rational)
degrees = System.BitConverter.ToInt32(byte_property_id, 0) / System.BitConverter.ToInt32(byte_property_id, 4)
minutes = System.BitConverter.ToInt32(byte_property_id, 8) / System.BitConverter.ToInt32(byte_property_id, 12)
seconds = minutes - Int(minutes)
minutes = Int(minutes)
seconds = 60 * seconds
LAT = CStr(degrees) & "d " & CStr(minutes) & ":" & CStr(Int(seconds))
ElseIf TheProperty = 3 Then
'Longitude East or West
EorW = System.Text.Encoding.ASCII.GetString(byte_property_id)
ElseIf TheProperty = 4 Then
'Longitude degrees minutes and seconds (rational)
degrees = System.BitConverter.ToInt32(byte_property_id, 0) / System.BitConverter.ToInt32(byte_property_id, 4)
minutes = System.BitConverter.ToInt32(byte_property_id, 8) / System.BitConverter.ToInt32(byte_property_id, 12)
seconds = minutes - Int(minutes)
minutes = Int(minutes)
seconds = 60 * seconds
LON = CStr(degrees) & "d " & CStr(minutes) & ":" & CStr(Int(seconds))
ElseIf TheProperty = 6 Then
Altitude = System.BitConverter.ToInt32(byte_property_id, 0)
End If

Next TheProperty

TheString = (LAT + " " + NorS + " " + LON + " " + EorW + " " + CStr(Altitude))

Return TheString

End Function]
Jozi68 9-Feb-11 3:06am View    
Did you assume that I expect someone to write the entire application for me?
Did you perhaps vote based on that assumption?