Para obtener el ancho, el alto, y el tamaño en KBytes de una imagen, utiliza el siguiente código:
VB.NET:
-
Dim Im As New System.Drawing.Bitmap("c:\Imagen.jpg")
-
Dim FIm As New FileInfo("c:\Imagen.jpg")
-
Dim TamanoBytes, TamanoKBytes As Long
-
TamanoKBytes = FIm.Length / 1024
-
TamanoBytes = FIm.Length 'Por si lo quieres en Bytes
-
'InfoImagen es un Label
-
InfoImagen.Text = "Ancho: " & Im.Width & " pixeles; Alto: " & Im.Height & " pixeles; Tamaño: " & TamanoKBytes & " KB;"
-
'Siempre recuerda cerrar el Bitmap
-
Im.Dispose()
Si no cierras el Bitmap utilizando su método Dispose, aparecerá un error que dice que la imagen está siendo utilizada por otro proceso cuando la quieras borrar o modificar su nombre.