Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

how i can change image size?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tark Siala - 08 Oct 2007 11:53 GMT
hi
i'm wprking with C# 2005 + SP1, and i want load image from image file, and
then resize it (like from 800X600 Pixel to 640X480 Pixel), and then save it
in another image file, i want do that for resize many images to publish it
on the internet, the picture box can load image and resize it on the screen,
but can't save it with new dimension.

can you help me?
-----------
Tarek M. Siala
Software Developer
http://tarksiala.blogspot.com
Göran Andersson - 08 Oct 2007 13:56 GMT
> hi
> i'm wprking with C# 2005 + SP1, and i want load image from image file, and
> then resize it (like from 800X600 Pixel to 640X480 Pixel), and then save it
> in another image file, i want do that for resize many images to publish it
> on the internet, the picture box can load image and resize it on the screen,
> but can't save it with new dimension.

Create a new Bitmap object with the desired size, use Graphics.FromImage
to create a graphics object for the bitmap, use the DrawImage method to
draw the original image onto the bitmap, then finally save the bitmap as
a file.

Signature

Göran Andersson
_____
http://www.guffa.com

Nicholas Paldino [.NET/C# MVP] - 08 Oct 2007 13:59 GMT
Tark,

   You will want to create a new Bitmap class instance with the dimensions
that you want to resave the image to.  Then, you will call the static
FromImage method on the Graphics class to get the Graphics instance for the
new image.  Once you have that, you can call the DrawImage method on the
Graphics instance, passing the original image (and the new image
dimensions).

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> hi
> i'm wprking with C# 2005 + SP1, and i want load image from image file, and
[quoted text clipped - 8 lines]
> Software Developer
> http://tarksiala.blogspot.com

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.