user2195741
user2195741

Reputation:

How do I display a tiff image?

Im totally lost and i need some to guide me. I've seem many post but none explain how can display a tif image. Where can i find some toturial? I need from the begining if posible. Or if you can help me with would it be greate. Im just a newbie halding image. Im using mvc 4

Upvotes: 3

Views: 4880

Answers (1)

Tim Rogers
Tim Rogers

Reputation: 21723

Most browsers can't handle TIFF images as you've probably found, so you'll need to convert it to a PNG or JPEG. In your controller action, these are the basics.

var memoryStream = new System.IO.MemoryStream();
using (var image = System.Drawing.Image.FromFile("myfile.tif"))
    image.Save(memoryStream, ImageFormat.Png);

return File(memoryStream, "image/png");

Upvotes: 5

Related Questions