On Oct 1, 8:13 pm, Guillermo Jimenez
<GuillermoJime. ..@discussions. microsoft.comwr ote:
Hi....
Please help me with this case. I need to show an image .TIFF in a .aspx web
page. The web site is developer on Visual Studio 2005. The image control no
support this image format, that control i can use to show this format???
Thanks.
Here's a sample script that will work as showimage.aspx?
image=file.tiff , where file.tiff is a name of the file in the root
<%@ Page Language="C#" %>
<script runat="server">
void Page_Load(Objec t sender, EventArgs e)
{
string imageLocation = Server.MapPath( Request.QuerySt ring["image"]);
System.Drawing. Bitmap origBitmap = new
System.Drawing. Bitmap(imageLoc ation);
System.Drawing. Bitmap outputImage = new
System.Drawing. Bitmap(origBitm ap);
System.Drawing. Imaging.ImageFo rmat outputFormat =
System.Drawing. Imaging.ImageFo rmat.Jpeg;
outputImage.Sav e(Response.Outp utStream, outputFormat);
outputImage.Dis pose();
origBitmap.Disp ose();
}
</script>
as you can see it converts an image into Jpeg. Note, that the
System.Drawing. Bitmap object has a problem to load some TIF files.
Some work and some don't ("Parameter is not valid" error is thrown).
As I see it can be a problem of the format. For example, for files
with no compression, or in LZW it would work, and ZIP is not working.
Hope it helps