Tech Off Thread

15 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Tiff Images

Back to Forum: Tech Off
  • User profile image
    Red5

    Looking for suggestions for a component to view TIFF images in a browser. The best one I've found is from Alternatiff (www.alternatiff.com). It has most of the features I am seeking. Our TIFF images have a resolution of 240 x 120 natively, and this component renders them correctly. Any suggestions?

  • User profile image
    W3bbo

    I thought IE could render TIFF images OOB.

  • User profile image
    Red5

    Not any version of IE I am aware of. 
    IE only handles JPG, GIF, PNG, and BMP.

  • User profile image
    Harlequin

    The QuickTime plugin parses tif images I believe.

  • User profile image
    csharp1171

    using System.Data;
    using System.Drawing.Imaging;
    using System.IO;

    ...

    MemoryStream strm = new MemoryStream();     

    Bitmap myImg = new Bitmap("SOME PATH TO THE TIFF");

    try
    {
     Response.ContentType = "image/Jpeg";
     
     myImg.Save(strm, ImageFormat.Jpeg);

     byte[] buffer = strm.ToArray();
                           
     Response.OutputStream.Write(buffer, 0, buffer.Length);
     strm.Close();
    }
    catch (Exception ex)
    {
     // do something with the exception
    }
    finally
    {
     myImg.Dispose();
    }

    For multipage tiffs you want to look into the SelectActiveFrame() method to select the desired page.  You can also rotate the image using the RotateFlip() method.

  • User profile image
    Harlequin

    csharp1171 wrote:

    using System.Data;
    using System.Drawing.Imaging;
    using System.IO;

    ...



    He was looking for a browser component though so he can view them Smiley

  • User profile image
    csharp1171

    I guess I didn't read well enough.  Rather than worrying about downloading and installing an ActiveX control the code sample would convert at the server and stream it to the browser.  Good luck.

  • User profile image
    Red5

    csharp1171 wrote:

    using System.Data;
    using System.Drawing.Imaging;
    using System.IO;

    ...

    MemoryStream strm = new MemoryStream();     

    Bitmap myImg = new Bitmap("SOME PATH TO THE TIFF");

    try
    {
     Response.ContentType = "image/Jpeg";
     
     myImg.Save(strm, ImageFormat.Jpeg);

     byte[] buffer = strm.ToArray();
                           
     Response.OutputStream.Write(buffer, 0, buffer.Length);
     strm.Close();
    }
    catch (Exception ex)
    {
     // do something with the exception
    }
    finally
    {
     myImg.Dispose();
    }

    For multipage tiffs you want to look into the SelectActiveFrame() method to select the desired page.  You can also rotate the image using the RotateFlip() method.



    Scalability might be an issue here.  I've done similar code to this using GDI+, but not on a web server.  I like the way you think though; avoid a plug-in if you can.

  • User profile image
    Maurits

    Red5 wrote:

    Scalability might be an issue here.


    Could you run TIFF-to-JPG conversion on the files (including multiple pages,) store the JPG files on the server, and serve those?

  • User profile image
    W3bbo

    Maurits wrote:
    Red5 wrote:
    Scalability might be an issue here.


    Could you run TIFF-to-JPG conversion on the files (including multiple pages,) store the JPG files on the server, and serve those?


    That would result in a lot less load on the server too.

  • User profile image
    Red5

    W3bbo wrote:
    would result in a lot less load on the server too.


    Unfortunately, probably not.  Over a terabyte of images in our repository, and growing. . .
    The average TIFF size is around 150KB with PackBits compression.
    The application could have around 1,000 users at one time, with each user requesting 40 images at a time, to be shown in sequence.

    The ActiveX I mentioned seems to work quite well for our purposes, but I was hoping to design the application without the requirement of IE 5.5+.  The Alternatiff control is pretty cool in terms of zooming into an image. Zoominig is a requirement for accessability. 

  • User profile image
    blowdart

    QuickView Plus? it plugs into IE nicely, and handles TIFF

  • User profile image
    Red5

    blowdart wrote:
    QuickView Plus? it plugs into IE nicely, and handles TIFF


    I tried it out, but it would not integrate into my IE, for whatever reason.  I was able to use it as a stand-alone view to try some of our TIFF images in it.
    Our TIFF images are not typical.  The images are 240dpi on the X coordinate and 120dpi on the Y coordinate.  QuickView Plus does not render this correctly by correcting the Y coordinate to match the X coordinate.  This type of scaling is typical in our industry where we use high-speed image scanners to grab full page scans.

    Thanks for your suggestion though.  QuickView looks like a good product otherwise.

  • User profile image
    Harlequin

    A thumbnail generator would be able to cache images, so they're not generated on the fly every time.

     e.g. thumbnail.aspx
    <%@ Page Language="C#" ContentType="image/jpg" Inherits="MyNamespace.ThumbGenerator" %>
    <%@ OutputCache Duration="300" VaryByParam="filename" %>

  • User profile image
    Red5

    Just a bump();
    I never followed up on this one.

    We ended up using Alternatiff.  Our users really like it and are pleased with its performance and accessability options.
    We are now tied to using IE for the time being, but that has not been an issue for our environment(s).

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.