Click here to Skip to main content
15,910,980 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: How to create Folder with help of ASP.NET Pin
dj.rock7-Nov-06 22:01
dj.rock7-Nov-06 22:01 
QuestionHow to Implement Business Entity? Pin
nabeelkhan7-Nov-06 21:11
nabeelkhan7-Nov-06 21:11 
Questionkey ascii Pin
litson jose7-Nov-06 20:52
litson jose7-Nov-06 20:52 
AnswerRe: key ascii Pin
Deepak the Cool7-Nov-06 21:12
Deepak the Cool7-Nov-06 21:12 
QuestionReducing pixelization in images Pin
anu817-Nov-06 20:47
anu817-Nov-06 20:47 
AnswerRe: Reducing pixelization in images Pin
Deepak the Cool7-Nov-06 21:32
Deepak the Cool7-Nov-06 21:32 
GeneralRe: Reducing pixelization in images Pin
anu817-Nov-06 21:59
anu817-Nov-06 21:59 
AnswerRe: Reducing pixelization in images Pin
Britney S. Morales8-Nov-06 3:20
Britney S. Morales8-Nov-06 3:20 
Check this code

<br />
public void ResizeAndSave(int MaxWidth, int MaxHeight, string UrlAndFileName, string UrlAndnewFileName)<br />
    {<br />
        // load up the image, figure out a "best fit"<br />
        // resize, and then save that new image<br />
        Bitmap OriginalBmp = (System.Drawing.Bitmap)Image.FromFile(UrlAndFileName).Clone();<br />
        Size ResizedDimensions = GetDimentions(MaxWidth, MaxHeight, ref OriginalBmp);<br />
        Bitmap NewBmp = new Bitmap(OriginalBmp, ResizedDimensions);<br />
        NewBmp.Save(UrlAndnewFileName, System.Drawing.Imaging.ImageFormat.Jpeg);<br />
    }<br />
<br />
<br />
private static Size GetDimentions(int MaxWidth, int MaxHeight, ref Bitmap Bmp)<br />
    {<br />
        int Width;<br />
        int Height;<br />
        float Multiplier;<br />
<br />
        Height = Bmp.Height;<br />
        Width = Bmp.Width;<br />
<br />
        // this means you want to shrink<br />
        // an image that is already shrunken!<br />
        if (Height <= MaxHeight && Width <= MaxWidth)<br />
            return new Size(Width, Height);<br />
<br />
        // check to see if we can shrink it width first<br />
        Multiplier = (float)((float)MaxWidth / (float)Width);<br />
        if ((Height * Multiplier) <= MaxHeight)<br />
        {<br />
            Height = (int)(Height * Multiplier);<br />
            return new Size(MaxWidth, Height);<br />
        }<br />
<br />
        // if we can't get our max width, then use the max height<br />
        Multiplier = (float)MaxHeight / (float)Height;<br />
        Width = (int)(Width * Multiplier);<br />
        return new Size(Width, MaxHeight);<br />
    }<br />


You must to invoice the resizeAndSave Function. the parameters are four
Here you have a parameters examples
MaxWidth : Final width size (pix) = 200
MaxHeight : Final height size (pix) = 200
UrlAndFileName : The original image Url = c:\folder1\image1.jpg
UrlAndnewFileName : The final path and file name, to save the NEW resized image = c:\newimage.jpg



PD: Only works with jpg images

Check tue quality picture and tell me if it you are looking for. Smile | :)


keep Learning and you never will be out of date...

Questionasp:listbox move item by javascript Pin
karanba7-Nov-06 20:41
karanba7-Nov-06 20:41 
AnswerRe: asp:listbox move item by javascript Pin
Sandeep Akhare7-Nov-06 21:18
Sandeep Akhare7-Nov-06 21:18 
GeneralRe: asp:listbox move item by javascript Pin
karanba7-Nov-06 21:41
karanba7-Nov-06 21:41 
AnswerRe: asp:listbox move item by javascript Pin
Mahesh.Vaghela7-Nov-06 23:07
Mahesh.Vaghela7-Nov-06 23:07 
GeneralRe: asp:listbox move item by javascript Pin
karanba7-Nov-06 23:42
karanba7-Nov-06 23:42 
QuestionHow to define event for a page? [modified] Pin
immori7-Nov-06 20:34
immori7-Nov-06 20:34 
AnswerRe: How to define event for a page? Pin
_mubashir7-Nov-06 21:28
_mubashir7-Nov-06 21:28 
QuestionHow to increament date value Pin
Sam.M7-Nov-06 20:15
Sam.M7-Nov-06 20:15 
AnswerRe: How to increament date value Pin
johnny19807-Nov-06 20:34
johnny19807-Nov-06 20:34 
AnswerRe: How to increament date value Pin
_mubashir7-Nov-06 20:35
_mubashir7-Nov-06 20:35 
QuestionLiteral control retain text even with viewstate disabled Pin
Nitin19817-Nov-06 19:52
Nitin19817-Nov-06 19:52 
QuestionUse multiple web.config in one application Pin
Sushant Duggal7-Nov-06 19:35
Sushant Duggal7-Nov-06 19:35 
AnswerRe: Use multiple web.config in one application Pin
_AK_7-Nov-06 19:37
_AK_7-Nov-06 19:37 
AnswerRe: Use multiple web.config in one application Pin
Sandeep Akhare7-Nov-06 19:45
Sandeep Akhare7-Nov-06 19:45 
GeneralRe: Use multiple web.config in one application Pin
Sushant Duggal7-Nov-06 19:48
Sushant Duggal7-Nov-06 19:48 
GeneralRe: Use multiple web.config in one application Pin
PavanPareta10-Nov-06 1:23
PavanPareta10-Nov-06 1:23 
GeneralRe: Use multiple web.config in one application Pin
Sushant Duggal7-Nov-06 19:52
Sushant Duggal7-Nov-06 19:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.