Click here to Skip to main content
11,709,366 members (64,401 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# LINQ ASP.NET4.0
Hi Guys,
am a student and am developing a project for my first semester i need a help please if any one here to help me then please let me how how can i do this
i want to do resize image size with using c# code in i make a code that is this

string Headerpath = "~/hf_images/" + FileUploadHeader.FileName;
string Footerpath = "~/hf_images/" + FileUploadFooter.FileName;
Event.AddEvent(Convert.ToInt32( Headerpath, Footerpath);

what i want to do with my this code there is a two FileUploader (Header and Footer) i want to resize this both images when i click on save button and also want to save Header and Footer new size image path in database and new image in gf_image folder please edit my this code and know me how can i do this and resize hight:20px; and widht:40px; please update my this code and and provide me proper code for that.
Thank You
Posted 12-Jun-12 22:05pm
Edited 12-Jun-12 22:15pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

We don't give/edit code here.

There are enough articles/examples on internet of this topic. Look at the links below, they can give you a head start:

Image in C#: Save, Resize, and Convert to Binary[^][^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

public static System.Drawing.Image ScaleImage(System.Drawing.Image image, int maxHeight)
        var ratio = (double)maxHeight / image.Height;
        var newWidth = (int)(image.Width * ratio);
        var newHeight = (int)(image.Height * ratio);
        var newImage = new Bitmap(newWidth, newHeight);
        using (var g = Graphics.FromImage(newImage))
            g.DrawImage(image, 0, 0, newWidth, newHeight);
        return newImage;

For detail
Click here
sandeepwect at 7-Jun-13 10:41am
i have uploaded picture in a folder in project. I want to show the pics on different pages in different size without loosing the quality of the picture. Please solve my query asap.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 580
1 OriginalGriff 250
2 Maciej Los 225
3 Peter Leow 219
4 Mika Wendelius 160
0 OriginalGriff 9,428
1 Sergey Alexandrovich Kryukov 9,027
2 CPallini 5,189
3 Maciej Los 4,991
4 Mika Wendelius 3,856

Advertise | Privacy | Mobile
Web01 | 2.8.150819.1 | Last Updated 17 Aug 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100