I'm a little new at ASP.Net, so bear with me. I have a page where users upload bitmaps to my site. I then convert them to JPGs of the same size and destroy the bitmaps. In doing so, they lose color quality a little and become a little blurry. Is there any way around this? Here is my code:
VB Code:
  1. <% ' import all relevant namespaces %>  
  2. <%@ Page Debug="true" %>
  3. <%@ import namespace="System" %>    
  4. <%@ import namespace="System.Drawing" %>    
  5. <%@ import namespace="System.Drawing.Imaging" %>    
  6. <%@ import namespace="System.IO" %>    
  7. <script runat="server" >
  8.        
  9. Sub ConvertFile()  
  10.            
  11.     ' create New image and bitmap objects. Load the image file and put into a resized bitmap.  
  12.     Dim g As System.Drawing.Image = System.Drawing.Image.FromFile(Request.Form("src")) 
  13.     Dim imgOutput
  14.    
  15.     If Request.Form("Thumbnail") > "" Then
  16.         imgOutput = New Bitmap(g, 130, 90)
  17.     Else
  18.         imgOutput = New Bitmap(g)
  19.     End If
  20.    
  21.    
  22.     ' Set the contenttype  
  23.     Response.ContentType = "image/jpeg"    
  24.  
  25.     ' send the converted image to the viewer    
  26.     imgOutput.save(Response.OutputStream, system.drawing.imaging.imageformat.JPEG) ' output to the user    
  27.            
  28.     ' tidy up  
  29.     g.dispose()
  30.     imgOutput.dispose()    
  31.            
  32. End Sub    
  33.        
  34. </script>  
  35. <%  
  36.        
  37. ' make sure Nothing has gone to the client  
  38. Response.Clear
  39. Call ConvertFile()
  40. Response.End
  41.        
  42. %>