locked
resizing images RRS feed

  • Question

  • User898048251 posted

    I am displaying images from a database using the code below. Is there any way I can resize the images before rendering them?

    public void showSelectedImage(string strEncodedImage) 
    
    { 
    
    Response.Clear(); 
    
    Response.ContentType = "image/jpeg"; 
    
    System.Drawing.Image image = retrieveImage(strEncodedImage); 
    image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg); 
    } 
     
    private System.Drawing.Image retrieveImage(string strEncodedImage)
    { 
    System.Drawing.Image image = null; 
    byte[] imageData = Convert.FromBase64String(strEncodedImage); 
    MemoryStream memStream = new MemoryStream(imageData); 
    image = System.Drawing.Image.FromStream(memStream); 
    return image; 
    }
    

     
     


     

    Thursday, September 3, 2009 9:09 AM

Answers

  • User-68639941 posted

     try with

    image.Height
    image.Width 


     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 3, 2009 10:17 AM