TechTalkz.com Logo Ask the Experts!

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Programing Languages > C#(C Sharp)

how i can change image size?

C#(C Sharp)

 
 
Thread Tools Display Modes
Unread 08-10-2007, 11:05 AM   #1
Tark Siala
Guest
 
Posts: n/a
how i can change image size?

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


 
Unread 08-10-2007, 01:06 PM   #2
Göran Andersson
Guest
 
Posts: n/a
Re: how i can change image size?

Tark Siala wrote:
> 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.

--
Göran Andersson
_____
http://www.guffa.com
 
Unread 08-10-2007, 01:06 PM   #3
Nicholas Paldino [.NET/C# MVP]
Guest
 
Posts: n/a
Re: how i can change image size?

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).

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

"Tark Siala" <tarksiala@icc-libya.com> wrote in message
news:%23$qf%23lZCIHA.4836@TK2MSFTNGP06.phx.gbl...
> 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
>
>


 
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
IE caching image size somewhere when doing DHTML (not temp int fil Rob Internet Explorer 0 07-09-2007 03:02 PM
FromImage loading smaller version of image with wrong size Jon Slaughter C#(C Sharp) 7 05-09-2007 09:20 AM
Display Image Size Waz Up Windows XP 1 27-08-2007 05:19 PM
Print image size on page Joan of Arc Windows XP 0 16-08-2007 10:32 AM
Display Size of Image. Waz Up Windows XP 7 16-08-2007 05:13 AM


< Home - Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT. The time now is 08:30 AM.


vBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2013, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional