473,765 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7668
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.FromIm age
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.co m

"Tark Siala" <ta*******@ic c-libya.comwrote in message
news:%2******** **********@TK2M SFTNGP06.phx.gb l...
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
8398
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 PIL? If I use this script it changes the dpi, but the picture becomes huge. Thanks Arjen
2
8535
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 like "gcnew is undeclared error",how to deeclare 'gcnew" and when i am using in runtime to change the size of images in imagelist in listview control in .net(forms application) by chnging one trckbar(like tb1->Value),
0
1549
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" AutoGenerateColumns="False" ShowHeader="False"> <Columns><asp:BoundColumn Visible="False" DataField="Property_ID" HeaderText="Property_ID"></asp:BoundColumn><asp:TemplateColumn><ItemTemplate><table
0
1801
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 web server in a jpg format. I also would like to save the jpg format in different resolutions. I have looked on the internet and haven't been able to find any code examples can you help.
1
1753
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 anyone give me a hint how to do this? So far it looks like: <tr> <td class="frontbar"> <a href="#"><img src="images/dot.gif" width="10"
8
36328
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
1678
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 to change the size of image and decrease it's size and i have another question how can i show an image file in an image control with maintaining the aspect ratio of that i don't wanna the image control stretch the image
8
2345
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
19319
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 display one by one automatically with correct resized image please help thanks in advances
5
4656
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. Within the area, i would like to display an image and some text, overriding a few words with an inline style. i would like the image to change once the mouse is placed over it. and when the mouse is removed from the image the image should...
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9399
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10163
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9957
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.