.NETGURU
How to resize imgs w System.Drawing
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-drawing' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

=?iso-8859-1?Q?Andr=E9_Colbi=F6rnsen?=
I wonder if and how it's possible to resize an img (gif or jpg) on the
fly using System.Drawing. When I say resizing, I mean both pixelsize AND
filesize.

Regards/H=E4lsningar

Andr=E9 Colbi=F6rnsen
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
Sonnenburg Communications
Bergsgatan 3,
SE-211 54 Malm=F6
Sweden
Tel.: +46-(0)40-97 78 80
Fax.: +46-(0)40-97 78 80
Mob.: +46-(0)708-97 78 79
Mail: Click here to reveal e-mail address
Web.: www.sonnenburg.se
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D

Reply to this message...
 
    
Chris Kinsman
You can definitely change the pixel size. Not sure what you mean by
changing the file size. If you save the image whose pixel size has
changed the file size will also naturally change.

-----Original Message-----
From: Andr=E9 Colbi=F6rnsen [mailto:Click here to reveal e-mail address]=20
Sent: Monday, January 21, 2002 10:07 AM
To: ngfx-drawing
Subject: [ngfx-drawing] How to resize imgs w System.Drawing

I wonder if and how it's possible to resize an img (gif or jpg) on the
fly using System.Drawing. When I say resizing, I mean both pixelsize AND
filesize.

Regards/H=E4lsningar

Andr=E9 Colbi=F6rnsen
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
Sonnenburg Communications
Bergsgatan 3,
SE-211 54 Malm=F6
Sweden
Tel.: +46-(0)40-97 78 80
Fax.: +46-(0)40-97 78 80
Mob.: +46-(0)708-97 78 79
Mail: Click here to reveal e-mail address
Web.: www.sonnenburg.se
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D

| [ngfx-drawing] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-drawing.asp =3D JOIN/QUIT

Reply to this message...
 
    
Kloberg Mac (LAM) (VIP)
The most efficient way to resize an image is probably to use the =
DrawImage
method of the Graphics object:=20

NewSize =3D New Size(CType(oImage.Width * Ratio, Integer), =
CType(oImage.Height
* Ratio, Integer))
oImageBitmap =3D New Bitmap(NewSize.Width, NewSize.Height)
oGraphics =3D Graphics.FromImage(oImageBitmap)
oGraphics.DrawImage(oImage, 0, 0, NewSize.Width, NewSize.Height)

hth
--
Sincerely,
Mac Kloberg
LIEBHERR AMERICA INC.
http://www.liebherr.com

-----Original Message-----
From: Andr=E9 Colbi=F6rnsen [mailto:Click here to reveal e-mail address]
Sent: Monday, January 21, 2002 1:07 PM
To: ngfx-drawing
Subject: [ngfx-drawing] How to resize imgs w System.Drawing

I wonder if and how it's possible to resize an img (gif or jpg) on the
fly using System.Drawing. When I say resizing, I mean both pixelsize =
AND
filesize.

Regards/H=E4lsningar

Andr=E9 Colbi=F6rnsen
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
Sonnenburg Communications
Bergsgatan 3,
SE-211 54 Malm=F6
Sweden
Tel.: +46-(0)40-97 78 80
Fax.: +46-(0)40-97 78 80
Mob.: +46-(0)708-97 78 79
Mail: Click here to reveal e-mail address
Web.: www.sonnenburg.se
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D

| [ngfx-drawing] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-drawing.asp =3D JOIN/QUIT

Reply to this message...
 
 
System.Drawing.Graphics




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification