| | |
Get File Info
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Apr 2008
Posts: 75
Reputation:
Solved Threads: 0
I want to get the width & height of the image file..
Mine code is currently getting the file size, I also want to get the width & height.How to get width & height,kindly help me.
Mine code is currently getting the file size, I also want to get the width & height.How to get width & height,kindly help me.
VB.NET Syntax (Toggle Plain Text)
Imports System.IO Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try Dim sFileSize As String Dim FS As System.IO.FileInfo = New System.IO.FileInfo("C:\Documents and Settings\Mansi\Desktop\Image.jpg") sFileSize = FS.Length.ToString MsgBox(sFileSize) Catch ex As Exception MsgBox(ex.Message) End Try End Sub
You have two sets of sizes for a picture --- the physical size of the image (if you were to print it and not grow/shrink/stretch the image) and the pixel size.
vb.net Syntax (Toggle Plain Text)
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim fName As String = "C:\picture.bmp" Dim img As Image = Image.FromFile(fName) Dim pixelHeight As Integer = img.Size.Height Dim pixelWidth As Integer = img.Size.Width Dim physicalHeight As Decimal = img.Size.Height / img.VerticalResolution Dim physicalWidth As Decimal = img.Size.Width / img.HorizontalResolution System.Diagnostics.Debugger.Break() img.Dispose() End Sub
Last edited by sknake; Aug 11th, 2009 at 4:12 pm.
![]() |
Similar Threads
- create and write into INFO File from C# (C#)
- paging file info (Motherboards, CPUs and RAM)
- File operations (C)
- Copying a folder into Excel or text file (Windows NT / 2000 / XP)
- read excel records in asp not refreshing (is the excel file cached) (ASP)
- parse a csv file (PLEASE HELP) (Java)
- File size in C (Win32) (C)
- How do I pass data from a recordset on asp page towards an array on js file (HTML and CSS)
- How do I pass data from a recordset on asp page towards an array on js file (JSP)
- Lines are being skipped in the input file. (Visual Basic 4 / 5 / 6)
Other Threads in the VB.NET Forum
- Previous Thread: Problem by writting the sql statement
- Next Thread: Need help with code!
| Thread Tools | Search this Thread |
.net .net2008 2008 access add advanced application array assignment basic beginner box browser button buttons center click client code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationtopic eclipse editvb.net employees excel exists filter forms function html images isnumericfuntioncall listview map mobile module msaccess mssqlbackend mysql net number open page pan panel pdf picturebox picturebox2 port position print printing printpreview read record regex reuse right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure temp textbox timer timespan transparency txttoxmlconverter usercontol vb vb.net vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web winsock wpf wrapingcode xml year






