Displaying Tiff Image on browser

Hi friends ,
I want to display tiff image on browser . For that i have written one servlet witch will desplay tiff image on browser
Here i am sending my code snippets for servlet.
Here file is source file which i want to display.
FileSeekableStream ss = new FileSeekableStream(file);
          ImageDecoder tiffDecoder= ImageCodec.createImageDecoder("tiff", ss, null);;
          p = tiffDecoder.getNumPages();
          for(int x=0;x<p;x++){
          RenderedImage tiffPage = tiffDecoder.decodeAsRenderedImage(x);
          ByteArrayOutputStream stream = new ByteArrayOutputStream();
     TIFFEncodeParam tiffOptions = new TIFFEncodeParam();
     // You may want to set compression or tile attributes on the     EncodeParam here
     RenderedOp l_return = JAI.create("encode", tiffPage, stream,"TIFF", tiffOptions);
     bt = stream.toByteArray();
then writing this byte array(bt)
OutputStream out;
out.write(bt);
and responce .setContentType("image/tiff");
i also want to know whether mime type image/tiff is supported or not in servlet.
When i run servlet i am getting File Downloading dialog box.
also when i download image file it's size is very large than original.
Plz correct my code.It's verry urgent.
Thanks in Advance

hi, could you post the solution?
I'm looking forward to know the solution.
Thanks

Similar Messages

  • Displaying TIFF images in Oracle Forms 6i

    Hello, friends!
    I am working in Oracle Forms 6.0.8 (that ancient tool) and encounter a problem with displaying TIFF images.
    I have a number of scanned images and some of them are displayed and some are not. I've tried both extracting them from the database or from the file system (using READ_IMAGE_FILE). Sometimes I am getting just blank field in my image item and sometimes (after using READ_IMAGE_FILE) I get the error FRM-47100 (cannot read image file). Of course I've checked that all the files are displayed using standard tools for displaying TIFFs.
    Basically the question is what kind of TIFF is considered valid and readable by Oracle Forms.
    Analyzing TIFF tags actually gave me nothing: I have a pair of files with tags different only in image width/length and a number of rows/strip (but even those values are close), and one of the file is displayed correctly while the other is not. The thing I noticed is that invalid files are using compression type of CCITT Group 4.
    Possibly Oracle Forms follows TIFF specification only to certain extent and does not support all the extensions, while sometimes the problems are not visible to user.
    As a result of my work I need some automatic tool that converts undisplayable TIFF files to displayable ones but firstly I am to determine where the problem is. And it would be very good to have a prooflink that approves my decision.
    Looking forward to any help! Thanks in advance.

    Thanks to everybody, but I'm afraid my files don't contain any EXIF tags (although TIFF seems to support them). The file doesn't contain any tags with IDs greater than 0x7FFF but only core TIFF tags (with IDs of lower numbers). Moreover I have a file with exactly the same set of tags (but the values are a bit different) which is displayed properly.
    I've shared the issued file (nondisplayable) on the following link: [https://rapidshare.com/files/3137807470/2.tif]
    If anyone could tell me why isn't it displayed in Forms I would be very grateful.

  • Displaying 2 images in browser.

    Hi, I have 2 TIFF images. That i have streamed using JAI.
    RenderedOp image = JAI.create("TIFF", inStream);
    My problem is that I am not able to display these 2 images together
    in the borwser.
    1.tif
    2.tif
    I tried using JAI translate operation to move other images below first image but unable to create final image as expected. This is the code i am using:
    //instream and instream 1 are ByteArraySeekableStream of 2 diff images.
    RenderedOp image = JAI.create("TIFF", inStream);
    RenderedOp image1 = JAI.create("TIFF", inStream1);
    ParameterBlock pb1 = new ParameterBlock();
              pb1.addSource(image);
              Interpolation interp = Interpolation.getInstance(Interpolation.INTERP_BILINEAR);
              pb1.add(0.0F);
              pb1.add(648.0F);
              pb1.add(interp);
              // Create the translate operation
              image = JAI.create("translate", pb1, null);          
              ParameterBlock pb = new ParameterBlock();
              pb.addSource(image);
              pb.addSource(image1); // The source image
    RenderedOp image2 = JAI.create("add", pb);
    RenderedOp op = JAI.create("encode", image2, outStream, IImageFormat.PNG, null);
    //I am writing this out put to browser
    Any help will be appreciated.
    Thx in advance.
    Anoop

    about image resizing, it is very difficult issue.
    I did this code for my company in 2 whole weeks. and sure I can not post it.
    pluse this code was only for Jpeg files.
    I still can give u some hints,
    1- There is open source code I dont remeber its name ,I think it was JPEG Decoder for J2ME try to search for this.
    this code is said to be for J2ME, pulshit . when u just instansiate instance from this class u got OutOfMemory Error. but this code still good as concept.
    2- Use the previous code to do the decoding while reading, I mean u will have to open stream on ur file then decode the data and resize.
    Good Luck

  • How to display TIFF images?

    Hello all.
    My web application needs tiff images viewer with a very primitive functionality like zoom. I'm a new in working with graphics and it seems like java.awt.image package doesn't support TIFF images format. From searching this forum I understood there are 3 party products like JAI to work with those images.
    Can somebody send me an example of how to read and display those images with zooming option; and/or how to convert from tiff to GIF/JPG formats (which also can be a solution for me).
    If somebody has a ready applet that implements the required functionality and can share it with me, I would appreciate it very much.
    Email: [email protected]
    Thanks in advance.

    I am also looking for Tiff Image zooming functionality. Please through your ideas or suggestions. I will appreciate your advises. If anyone has developed API, Please let me know, I am ready to look in to it. I will appreciate your quick response.

  • TIFF image in Browser

    I have TIFF images in folder in a machine on network ,when the user clicks the image link through browser i want the TIFF to open in the browser but the browser is not opening it infact IE is not doing anything but Firefox is atleast asking for file format viewer.
    Please help me
    Thanks in advance

    Please Help me.
    Iam still stuck with the problem.

  • Displaying TIFF image

    Hi everybody...!
    i am new to this forum and this is my first question in this forum. anybody can tell me how to display an image (tif). using drawImage() i can able to display gif image but i need tif image.
    thanks in advance.
    Ramesh

    i beleive TIFF is a propietry (spelling!) format. however i may be wrong... it has been known to happen ;)

  • Won't display background image in browser.

    My background image displays in dreamweaver and in the live view but it doesn't display in the browser when I try to view in a browser or when I publish the website.  I have spend hours looking for a solution and I am not sure what the problem is. I have checked the code on the following websites and it comes out ok:
    http://jigsaw.w3.org/css-validator/validator
    http://validator.w3.org/check
    I have also tried my code with and without the overflow: hidden;  under #container where the image should be displayed.  (i was trying a new way to design -ie without basic grid and floating everything so the container can be removed if needed)
    here is my code. Please help!!! thank you in advance!!!
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Jan Kardys' Literary Agency</title>
    <style type="text/css">
    #header {
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        float: left;
        width: 930px;
        color: #3F9;
    #Menu_bar {
        float: left;
        width: 190px;
    #Page_Content {
        float: right;
        width: 725px;
        height: 500px;
    #footer {
        float: left;
        width: 930px;
    #Main_content {
        float: left;
        width: 510px;
    #xtra_content {
        float: right;
        width: 190px;
    #container {
        width:  930px;
        margin: 0 auto;
        background-image: url(/Images/Parchment.gif);
        overflow: hidden;
    </style>
    <script src="file:///C|/Users/james/Documents/DREAMWEAVER SITES/SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    <link href="file:///C|/Users/james/Documents/DREAMWEAVER SITES/SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    body {
    </style>
    </head>
    <body>
    <div id= "container">
    <div id="header"><h1>Jan kardy's Literary Agency</h1></div>
    <div id="Menu_bar">
      <ul id="Vertical_menubar" class="MenuBarVertical">
        <li><a href="#">Home</a></li>
        <li><a href="#">About Jan Kardys</a></li>
        <li><a class="MenuBarItemSubmenu" href="#">Rescources</a>
          <ul>
            <li><a class="MenuBarItemSubmenu" href="#">Education Connection</a>
            </li>
            <li><a href="#">Submission Guidelines</a></li>
            <li><a href="#">First Steps to Publishing</a></li>
            <li><a href="http://advancenetworkingunicorn.blogspot.com/">Advanceced Networkinig Blog</a></li>
            <li><a href="#">Library &amp; Publishing Events</a></li>
    </ul>
        </li>
        <li><a href="#">Client Links</a></li>
        <li><a href="#">Art Gallery</a></li>
        <li><a href="#">Contact Jan Kardys</a></li>
      </ul>
    </div>
    <div id="Page_Content">
      <div id="Main_content">Content for  id "Main_content" Goes Here</div>
      <div id="xtra_content"><h3>News &amp; Events
        </h3>
        <p><a title="http://scotlandpubliclibrary.org/" onkeypress="window.open(this.href); return false;" onclick="window.open(this.href); return false;" href="http://scotlandpubliclibrary.org/">Scotland Public Library</a>, Scotland, CT April 21, 2011 6-8pm<br />
      </p>
        <p><a title="http://www.plymouthct.us/library.htm" onkeypress="window.open(this.href); return false;" onclick="window.open(this.href); return false;" href="http://www.plymouthct.us/library.htm">Plymouth CT Library</a>, Plymouth, CT April 30, 2011 10am<br />
        </p>
        <p><a title="http://www.hplct.org/" onkeypress="window.open(this.href); return false;" onclick="window.open(this.href); return false;" href="http://www.hplct.org/">Hartford Public Library</a>, Hartford, CT May 7, 2011 10am<br />
        </p>
        <p><a title="http://www.middleburghlibrary.org/" onkeypress="window.open(this.href); return false;" onclick="window.open(this.href); return false;" href="http://www.middleburghlibrary.org/">Middleburgh Library</a>, Middleburgh, NY May 14, 2011 1pm<br />
        </p>
        <p><a title="http://dewlib.org/" onkeypress="window.open(this.href); return false;" onclick="window.open(this.href); return false;" href="http://dewlib.org/">Dewitt Community Library</a>, Dewitt, NY June 21, 2011 7pm<br />
        </p>
        <p><a title="http://gilfordlibrary.org/gpl/" onkeypress="window.open(this.href); return false;" onclick="window.open(this.href); return false;" href="http://gilfordlibrary.org/gpl/">Gilford Public Library</a>, Gilford, NH July 7, 2011 6:30-7:30pm<br />
        </p>
        <p><a title="http://www.athollibrary.org/" onkeypress="window.open(this.href); return false;" onclick="window.open(this.href); return false;" href="http://www.athollibrary.org/">Athol Public Library</a> Athol, MA July 14, 2011 5:30pm<br />
        </p>
        <p><a title="http://www.goshenpublib.org/" onkeypress="window.open(this.href); return false;" onclick="window.open(this.href); return false;" href="http://www.goshenpublib.org/">Goshen Public Library</a> Goshen, CT July 23, 2011 11am<br />
        </p>
        <p><a title="http://columbiactlibrary.org/" onkeypress="window.open(this.href); return false;" onclick="window.open(this.href); return false;" href="http://columbiactlibrary.org/">Saxton B. Little Free Library</a>, Columbia, CT July 26, 2011 6:45pm<br />
        </p>
        <p><a title="http://hampden-library.org/" onkeypress="window.open(this.href); return false;" onclick="window.open(this.href); return false;" href="http://hampden-library.org/">Hampden Public Library</a>, Hampden, MA Sept. 10, 2011 10:30am<br />
        </p>
        <p><a title="http://fortlee.bccls.org/" onkeypress="window.open(this.href); return false;" onclick="window.open(this.href); return false;" href="http://fortlee.bccls.org/">Fort Lee Public Library</a>, Fort Lee, NJ Sept. 14, 2011 7:00pm<br />
        </p>
        <p><a title="http://prosserlibrary.info/" onkeypress="window.open(this.href); return false;" onclick="window.open(this.href); return false;" href="http://prosserlibrary.info/">Prosser Public Library</a>, Bloomfield, CT October 3, 2011 6:00-8:00pm<br />
        </p>
        <p><a title="http://iwwg.org" onkeypress="window.open(this.href); return false;" onclick="window.open(this.href); return false;" href="http://iwwg.org">IWWG. org</a>, New York City, October 16, 2011 2:30-6pm<br />
        </p>
        <p><a title="http://www.hchlibrary.org/" onkeypress="window.open(this.href); return false;" onclick="window.open(this.href); return false;" href="http://www.hchlibrary.org/">Henry Carter Hull Library</a>, Clinton, CT October 24, 2011 6:30pm<br />
        </p>
        <p><a href="http://town.canton.ma.us/library" title="http://town.canton.ma.us/library">Canton Public Library</a>, Canton MA Janurary 7, 2012  2:00pm<br />
        </p>
        <p><a href="http://www.town.sturbridge.ma.us/Public_Documents/F0000F86A/library" title="http://www.town.sturbridge.ma.us/Public_Documents/F0000F86A/library">Joshua Hyde Library</a>, Sturbridge, MA March 24, 2012 10:30am<br />
        </p>
        <p>Otis Library Norwich, CT April 14, 2012 12:00am-2:00pm<br />
        </p>
      </div>
    </div>
    <div id="footer"> <h6>Webpage designed by James S. Molina</h6></div>
    <script type="text/javascript">
    var MenuBar1 = new Spry.Widget.MenuBar("Vertical_menubar", {imgRight:"/SpryAssets/SpryMenuBarRightHover.gif"});
    </script>
    </div></body>
    </html>

    In regard to the files you currently have on your server, the links to your Spry menu files are still pointing to your local computer.  This is caused when a site has not yet been defined in Site Manager, so DW is forced to link them locally.
    To fix your page, just go into code view and remove the part of the link path that I have underlined and made BOLD.
    <script src="file:///C|/Users/james/Documents/DREAMWEAVER SITES/SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    <link href="file:///C|/Users/james/Documents/DREAMWEAVER SITES/SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />

  • Displaying the multi-tiff image in the browser

    Hi,
    I have been trying it...
    Please help me to get rid of this problem.. If this completes then almost my project is finished........ So, please guide me it's urgent.

    sagar_22 wrote:
    Hi,
    I have been trying it...What have you tried?
    So, please guide me it's urgent.It's not. I've no such requirement.
    Anyway, you need a browser plugin, as browsers out of the box can't display TIFF images (or most can't, there may be some that can but I've never seen them).

  • JSP Tiff Image Display

    Hi all,
    I have a problem in displaying Tiff image in jsp page. I am using Internet Explorer 6.0 . I have installed Tiff Image plug-in from the site www.alternatiff.com. If the location of the image is given directly i can view the image. But through javascript function if I pass the location of the image to the embed tag src then it is not diplayed.
    i have posted the code:
    <html>
    <head>
    </head>
    <SCRIPT LANGUAGE="JavaScript">
              function submitpage()
                   alert(document.forms[0].image.value)
                   document.forms[0].img.src=document.forms[0].image.value               
                   alert (document.forms[0].img.src)
    </script>                                        
    <body >
    <form >
    <table border="0" cellpadding="0" cellspacing="0" align=center>
         <tr><td>Image Location : <input type="text" name="image" /></td></tr>
         <tr><td> <embed src=" " alt="Cheque Image will come here" width="600" height="300" name="img">      <tr><td>      
         <tr> <td colspan=4 align=center><input type=button name="click" value="Submit" onclick="submitpage()" /></center></td> </tr>
    </table>
    </form>
    </body>
    </html>
    Is there anyother way to view the tiff image.
    Thanks in advance for any suggestions.

    Then I guess your Javascript writes crap.
    Where's the Java part of your question?

  • Unable to view TIFF image in BSP page

    Hi ,
    I have put in the URL of a TIFF image in the BSP code to display the image but the image refuses to appear. I found out that a TIFF image does not appear even in a normal HTML page. Is there any way to make this possible.

    Hi,
    we had the same problem. As far as I know there is no "build in" way to display tiff-images with a browser.
    We use a Java-applet to do this. We use ViewOne from Daeja image systems. Look at <a href="http://www.daeja.com/">http://www.daeja.com/</a>. That works very good.
    Hope that helps.
    Best regards
    Renald

  • Problem displaying tiff files using ADF

    Hi,
    I have some TIFF files in a table - IMAGE_TABLE
    ID NOT NULL NUMBER
    DESCRIPTION VARCHAR2(40)
    IMAGE ORDSYS.ORDIMAGE
    I am unable to display TIFF images in an ADF form. I can use processCopy to convert the TIFF images to jpeg, which them display correctly. All other JPEG or GIF display correctly, it's only the TIFF that don't. I've tried variours tiff files (different sources, converted gif and jpeg to tiff) but none display correctly (i.e. in IE you get the red 'x' - in firefox you get the broken picture symbol or nothing)?
    This appears to be an ADF issue as I 'can' dsiplay the TIFF files correctly in IE and firefox using the quicktime plugin but not from an ADF form using JDdevloper? (The code/application is Steve Muench's JSFOrdImageExample - http://otn.oracle.com/products/jdev/tips/muench/jsfordimage/JSFOrdImageExample.zip)
    Any ideas or suggestion would be appreciated.
    Thanks.
    JDeveloper 10.1.3 build 10.1.3.0.4
    DB is 10gr2

    Hi,
    yes, I can view tiff's in browsers (IE and firefox) using the quicktime plugin. I've selected quicktime as the player in the af:objectmedia property settings and Autostart = true, but using the ADF form from JDeveloper will not display tiff images (jpg's, giff's etc. are fine) even though the browser will display tiff's on it's own?
    Thanks.

  • Problem displaying tiff files

    Hi,
    I have some TIFF files in a table - IMAGE_TABLE
    ID NOT NULL NUMBER
    DESCRIPTION VARCHAR2(40)
    IMAGE ORDSYS.ORDIMAGE
    I am unable to display the TIFF images in an ADF form. I can use processCopy to convert the TIFF images to jpeg, which them display correctly. All other JPEG or GIF display correctly, it's only the TIFF that don't. I've tried variours tiff files (different sources, converted gif and jpeg to tiff) but none display correctly (i.e. in IE you get the red 'x' - in firefox you get the broken picture symbol or nothing)?
    Any ideas or suggestion would be appreciated.
    Is this an ADF issue?
    Thanks.
    JDeveloper 10.1.3 build 10.1.3.0.4
    DB is 10gr2

    Hi,
    yes, I can view tiff's in browsers (IE and firefox) using the quicktime plugin. I've selected quicktime as the player in the af:objectmedia property settings and Autostart = true, but using the ADF form from JDeveloper will not display tiff images (jpg's, giff's etc. are fine) even though the browser will display tiff's on it's own?
    Thanks.

  • How to go to particular page of a TIFF Image

    Hi to all,
    In my application i have to display TIFF Images.Here each TIFF Images consists of 5-10 pages.When we open that TIFF images generally it will start from page1.My problem is i have to directly go to page number 3 or 4 or 7 directly when i open the image.Can any one provide code for this problem.
    Thanks in Advance

    Hi to all,
    In my application i have to display TIFF
    Images.Here each TIFF Images consists of 5-10
    pages.When we open that TIFF images generally it will
    start from page1.My problem is i have to directly go
    to page number 3 or 4 or 7 directly when i open the
    image.Can any one provide code for this problem.
    Thanks in AdvanceSee http://asprise.com/product/javatiff/
    You can use something like this: tiffimage.getPage(int page);

  • Displaying an image that stored in DB

    Hi all intermedia professionals:
    I have a table that has a column that holds images ( BLOB datafile ).
    I want to know how I can display the image
    in Browser directly.
    Thanks for your answers
    Shahram

    There is a sample code available on OTN for loading and retrieving images through a web browser:
    http://otn.oracle.com/products/intermedia/
    Go to "Sample Code" and click "Load rich media content with a browser".

  • Sending Image to Browser

    Hello Guys !
    I need to load TIFF Image on Browser. Before this I'm converting to JPEG format whitout saving image on disk, just sending it to browser. This is the point: how can I format image in HTML format ?
    response.setContentType("image/jpeg");       
            ServletOutputStream sos = response.getOutputStream();
            RenderedOp src = JAI.create("fileload", "g:\\java\\00000001.TIF");
            ImageEncoder encoder = ImageCodec.createImageEncoder("JPEG",sos,null);       
            encoder.encode(src);Thanks !

    OK ! Now I see. But I don't know how to do that.
    I created a JSP FILE:
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page import="obj.*"%>
    <%
      NewServlet objServlet = new NewServlet(); 
      out.println("<img src=" + ?????????? + "/>"); 
    %>
    <html>
    <head><title>Image View</title></head>
    <body>
    </body>
    </html>And have a code in NewServlet:
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {       
            response.setContentType("image/jpeg");       
            ServletOutputStream sos = response.getOutputStream();
            RenderedOp src = JAI.create("fileload", "g:\\java\\00000001.TIF");
            ImageEncoder encoder = ImageCodec.createImageEncoder("JPEG",sos,null);       
            encoder.encode(src);       
        }HOW CAN I LINK THE NEWSERVLET WITH JSP FILE ???
    PS: I HOPE I'M NOT BORING YOU !!!!
    THANKS !

Maybe you are looking for