Skip Navigation LinksHome > Browse by Catagory > Input N Output > Get Image Spec.


Get Image Spec

Quick n easy way to get image information
Below is how to display image file specs (width and height, etc)

1st, you have to import system.IO, at the head of your code behind, add
Imports System.Drawing.Imaging

Return width of the image file
Public Shared Function intImageWidth(ByVal strFileName As String) As Integer
    'Create Image Object
    Dim objImage1 As System.Drawing.Image
    objImage1 = System.Drawing.Image.FromFile(strFileName)

    intImageWidth = objImage1.Width

    objImage1.Dispose()
End Function

Return Height of the Image File
Public Shared Function intImageHeight(ByVal strFileName As String) As Integer
    'Create Image Object
    Dim objImage1 As System.Drawing.Image
    objImage1 = System.Drawing.Image.FromFile(strFileName)

    intImageHeight = objImage1.Height

    objImage1.Dispose()
End Function
Tag: Image Spec IO
By: syantien | 1/13/2008 6:16:41 AM / 1/13/2008 6:17:08 AM

Comment

No comments yet.


Comment

Name
 

Title

Email

Comment
 

Your IP Address is: 38.107.191.82

* to keep comments safe and clean, we display and keep your ip address.