Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function GetImageSize(ImagePath As String) As Variant
- Dim imgSize(1) As Integer
- Dim wia As Object
- On Error Resume Next
- Set wia = CreateObject("WIA.ImageFile")
- If wia Is Nothing Then Exit Function
- On Error GoTo 0
- wia.LoadFile ImagePath
- imgSize(0) = wia.Width
- imgSize(1) = wia.Height
- Set wia = Nothing
- GetImageSize = imgSize
- End Function
- Sub Probar()
- Dim sampleImagePath As String
- sampleImagePath = "C:\Users\Elvis Cortijo\Documents\Cedula_Elvis.jpg"
- MsgBox "El tamaño de la imagen es:" & vbNewLine & _
- "Width: " & GetImageSize(sampleImagePath)(0) & " pixels" & vbNewLine & _
- "Height: " & GetImageSize(sampleImagePath)(1) & " pixels", vbInformation, "Medidas de Imagen"
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement