Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 28th, 2006, 10:04 AM
Authorized User
 
Join Date: Feb 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default How do I detect jpeg file dimensions?

Hi all,

I need a way to detect the image dimensions in pixels of a jpeg file on our asp.net server.

How to resize it into a smaller jpeg would be a bonus!

Thanks in advance,

Ru
 
Old April 28th, 2006, 08:56 PM
Authorized User
 
Join Date: Apr 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you can get the jpeg dimensions using Image class (System.Drawing) in c#

Image image = Image.FromFile(filepath);

then you have access to various properties... Including one that creates a thumbnail image which can be useful as well

 
Old May 2nd, 2006, 03:19 AM
Authorized User
 
Join Date: Feb 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is the VB solution, courtesy of Imar Spaanjaars :
http://imar.spaanjaars.com/QuickDocId.aspx?QUICKDOC=235

' Load the Image
Dim objImage As System.Drawing.Image = _
    System.Drawing.Image.FromFile("C:\MyImage.gif")

' Display its Height and Width
lblSize.Text = "Width: " & objImage.Width & "<br />Height: " & objImage.Height





Similar Threads
Thread Thread Starter Forum Replies Last Post
convert Image(jpeg/bmp,etc) file into binary forma venkat2reddy C# 2 September 14th, 2010 07:58 AM
XNA doesn't detect .jpg file? jpbaugh BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 1 September 9th, 2008 09:15 AM
DWH JUNK Dimensions maruthi.vm SQL Server 2005 0 December 14th, 2007 02:42 AM
extract XMP metadata from a JPEG file mega Classic ASP Professional 6 September 8th, 2006 05:03 AM
How do you save .esp & .jpeg file to clients cpu? GraphicArmy Forum and Wrox.com Feedback 5 May 7th, 2004 10:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.