Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 31st, 2006, 2:02 AM   #1
hbe02
Hobbyist Programmer
 
hbe02's Avatar
 
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3 hbe02 is on a distinguished road
Resizing an Image in .NET

hi everyone,
its been a while since my last anything at the forums, here is a question on resizing an Image in the .NET .. C#, VB, C++, doesnt matter
basicly what im doing is declaring an image file like this:
Image myImage = Image.fromFile("picture.jpeg");
I simply want to change the width and hieght of the image so that it can take up less space..
so how is that possible..?
Does the sizeconverter class do the job? if yes, how can i use the "Type" class to represent my new imgae size ?

thanks everyone,
happy new year
hbe02 is offline   Reply With Quote
Old Dec 31st, 2006, 4:59 AM   #2
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 399
Rep Power: 5 xavier is on a distinguished road
Send a message via Yahoo to xavier
Have you tried searching first ? http://www.codeproject.com/csharp/imageresize.asp
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Jan 9th, 2007, 6:58 AM   #3
hbe02
Hobbyist Programmer
 
hbe02's Avatar
 
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3 hbe02 is on a distinguished road
Thanks for the feedback xavier
For archives of the forums, here is a simple way of resizing an image in .NET
Size ResizedDimensions = new Size(192, 140);
Image tempImg = Image.FromFile("ImagetoResize.jpeg");
Bitmap NewBmp = new Bitmap(tempImg, ResizedDimensions);
tempImg.Dispose();
           
NewBmp.Save("resizedImage.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
NewBmp.Dispose();
hbe02 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Image corruption on some systems slyadams Java 0 Jun 1st, 2006 10:40 AM
Image float, wrap text, oh boy! DaveQB HTML / XHTML / CSS 1 May 20th, 2006 1:34 AM
Image Viewer (Urgent Bèta testing) SoniX Visual Basic .NET 8 Sep 21st, 2005 6:25 PM
Pragmatic image manipulation (resizing) kurifu C# 2 Aug 25th, 2005 7:52 PM
Checking source codes of image, audio and video files on_auc C++ 3 Feb 21st, 2005 9:36 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:03 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC