| | |
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!
Views: 754 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access account application arithmetic array arrays basic bing button buttons c# center check checkbox code convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog filter ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor net networking objects output panel passingparameters picturebox picturebox1 port position print printing problem project read remove save searchbox searchvb.net select serial shutdown soap sorting survey syntax table tcp temperature text textbox timer timespan toolbox trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio2008 web webbrowser winforms wpf year






