Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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
  #1 (permalink)  
Old August 23rd, 2004, 03:24 AM
Authorized User
 
Join Date: Aug 2004
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trouble with file size, PLEASE HELP!!!

Hi all,

I have written a little piece of code that uploads an image and resizes it before saving it to a database. The problem i have is with the file size of the resized image.

EG. Using a picture with dimensions of 800 x 600 and a file size of 70kb, I upload and resize to 400 x 300, the file size of the resized image however is 300kb, which is ridiculous and completely unacceptable.

If anyone could help with why the image file size becomes so large I would be greatful.

Thanks.

Brett.:(

  #2 (permalink)  
Old August 23rd, 2004, 08:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

What code do you use to resize? That would help. Are you switching picture formats or changing the resolution?

Brian
  #3 (permalink)  
Old August 25th, 2004, 03:42 AM
Authorized User
 
Join Date: Aug 2004
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi all,

Incase it is of any use, here is the code I use to resize and save the image:

Dim aFile As HttpPostedFile = Me.myFile.PostedFile

Dim fileName As String = Path.GetFileName(aFile.FileName)

Dim imgStream As Stream = aFile.InputStream()

Dim img_New As System.Drawing.Image = System.Drawing.Image.FromStream(imgStream)

Dim imgOutput As New System.Drawing.Bitmap(img_New,800,600)

imgOutput.Save(Server.MapPath(".") & fileName)


As I said, using this method seems to increase the file size.

Any help is appreciated.

Thanks

:(
  #4 (permalink)  
Old August 25th, 2004, 07:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Is it saving as a bitmap, instead of a gif or jpeg? I guess that from the System.Drawing.Bitmap class. If so, bitmaps are always going to be gigantic. See if you can go to a gif or jpeg.

Brian


Similar Threads
Thread Thread Starter Forum Replies Last Post
Include file trouble rstelma ASP.NET 1.0 and 1.1 Professional 3 February 12th, 2008 01:21 PM
Wrox File Share - 1g file size limit b67 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 May 7th, 2007 04:24 PM
file size dotnetprogrammer VS.NET 2002/2003 3 November 17th, 2004 01:33 AM
Get File Size into a variable brandon1974 Classic ASP Basics 1 July 22nd, 2003 12:41 AM





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