473,386 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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
Oct 8 '07 #1
2 7656
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
Oct 8 '07 #2
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]
- mv*@spam.guard.caspershouse.com

"Tark Siala" <ta*******@icc-libya.comwrote in message
news:%2******************@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

Oct 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: duikboot | last post by:
Hi there, In Photoshop I can, when I want to change the dpi(dots per inch) of a picture, arrange that the picture won't be resized. Do you know of a way, I can accomplish this in python with...
2
by: Sanjeeva Reddy | last post by:
hai Anti Keskinen, i have used the following code MyListView->LargeImageList->ImageSize = gcnew System::Drawing::Size(100, 100); // Sets large image size to 100, 100 here i am getting error...
0
by: csgraham74 | last post by:
Hi there, i have creted a datagrid control to display images using the following code. <asp:DataGrid id="dg_Properties" runat="server" HorizontalAlign="Center" Width="450px"...
0
by: Gavin | last post by:
Can anybody give me a code example of how to change an image size and resolution. I can upload a image file to a PostedFile. But what I need to do is change the size of that image and save it to my...
1
by: roN | last post by:
Hi, I have a table in which I would like to change the background image onMouseOver. I implemented it with CSS but IE doesn't support hovers on tables, so I'd need to go via JS for IE. Can...
8
by: Lad | last post by:
Is it possible to change a picture resolution with Python? Let's say I have a picture with a resolution of 96 dpi and I would like to increase to 256dpi or higher. Thank you for your reply. LL
2
by: miladhatam | last post by:
i've made a dynamic website that upload an image file in image directory with fileuploader control and it's name was renamed and get ready to show with image control but i have a problem i want...
8
by: miladhatam | last post by:
can i change the size of a file dynamically ? for example have 100 Kb and i want to decrease it to 20 Kb thanks
7
by: kadarkarai | last post by:
I am developing photo gallery in Macromedia Flash 8 and XML to retrive the Image. Image Size is all in different size. my question is How to Change image size at runtime in flash? so that image...
5
by: studentofknowledge | last post by:
hi guys im new to javascript and need some guidence please.. im trying to display a 400x400 pixel coloured area in the middle of a webpage that stays in the middle with a browser window resize....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.