code_junkie

Displaying Tiff files in SSRS reports

Nov 11th, 2011
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. Response.ContentType = "image/png";
  2. Response.Clear();
  3. using (Bitmap bmp = new Bitmap(tifFilepath))
  4. bmp.Save(Response.OutputStream, ImageFormat.Png);
  5. Response.End();
  6.  
  7. protected void Page_Load(object sender, EventArgs e)
  8. {
  9. Response.ContentType = "image/jpeg";
  10. Response.Clear();
  11. Bitmap bmp = new Bitmap(tifFileLocation);
  12. bmp.Save(Response.OutputStream, ImageFormat.Jpeg);
  13. Response.End();
  14.  
  15. }
  16.  
  17. Public Shared Function ToImage(ByVal imageBytes As Byte()) As Byte()
  18. Dim ms As System.IO.MemoryStream = New System.IO.MemoryStream(imageBytes)
  19. Dim os As System.IO.MemoryStream = New System.IO.MemoryStream()
  20. Dim img As System.Drawing.Image = System.Drawing.Image.FromStream(ms)
  21.  
  22. img.Save(os, System.Drawing.Imaging.ImageFormat.Jpeg)
  23.  
  24. Return os.ToArray()
  25. End Function
Add Comment
Please, Sign In to add comment