Displaying a tiff image in a browser.

Hi I need to display a tiff image in the browser which does not have a tiff plugin. I guess I have to convert the tiff to jpeg on the fly and write it in the output stream. Has anyone worked on this or knows any other way. Please not I dont want to create an intermediate jpeg file.

Thanks for your help. I am having one problem though. The tiff file is not being read. The ImageIO.read(file); is returning null. I guess I am using the wrong ImageIO class.( javax.imageio.ImageIO;). I am pasting the code below. See if you can find out the bug.
package tiffToJpg;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
* @author Deepak_Mulchandani
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
public class TiffToJpg extends GenericServlet
     public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
          File file=new File("Demo1.jpg");
     ServletOutputStream servletOuputStream=response.getOutputStream();
                    BufferedImage image = ImageIO.read(file);
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
          JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(baos);
                    encoder.encode(image);
               servletOuputStream.write(baos.toByteArray());
}

Similar Messages

  • 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).

  • Trying to display multipage tiff image getting error

    Hi
    I am trying to read multipage tiff image but dont know how
    I tried to display single page tiff getting error
    my code is
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Drawing;
    using System.Drawing.Imaging;
    namespace Documentviewer1
        public partial class _Default : System.Web.UI.Page
            //string filepath = "";
            protected void Page_Load(object sender, EventArgs e)
                //// filepath = "image\045237302.tif";
                string appath = Server.MapPath("/image") + @"\";
                string imagename = Request.QueryString["ImageFileName"];
                string filename = appath + imagename;
                Response.ContentType = "image/tiff";
                new Bitmap(filename).Save(Response.OutputStream, ImageFormat.Tiff);
                ////System.Drawing.Image TheImg = new App.Files.TIF(Request.QueryString["FilePath"]).GetTiffImageThumb(System.Convert.ToInt16(Request.QueryString["Pg"]), System.Convert.ToInt16(Request.QueryString["Height"]),
    System.Convert.ToInt16(Request.QueryString["Width"]));//getting error in thisline Parameter not valid
    my aspx page is has
    <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
        CodeBehind="Default.aspx.cs" Inherits="Documentviewer1._Default" %>
    <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    </asp:Content>
    <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
        <h2>
          <img alt="" src ="image/045237302.tif" width="200" height="200"/>
        </h2>
        <p>
            To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">www.asp.net</a>.
        </p>
        <p>
            You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&amp;clcid=0x409"
                title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>.
        </p>
    </asp:Content>
    getting error as Parameter not valid.
    Can anybody help me to display the image in the browser.
    Thanks
    Mary Abraham
    Mary Sunish

    Hi MaryAbraham,
    Since the issue regards ASP.NET and website deployment. I suggestion you post the question in the ASP.NET forums at
    http://forums.asp.net/. It is appropriate and more experts will assist you.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Problem in displaying a selected image from the browser

    How come I always get the same image (the last) when I select an image from a browser. I used IMAQ Browser Forcus (with mouse click)to send an index to Index Array, then with IMAQ WindDraw to display the image,but it is always the same image (the last) that shows in the new window.

    Try this VI (It's from "Image Acquisition and Processing with LabVIEW" - see for more details...
    cheers,
    Christopher
    Christopher G. Relf
    Certified LabVIEW Developer
    [email protected]
    International Voicemail & Fax: +61 2 8080 8132
    Australian Voicemail & Fax: (02) 8080 8132
    EULA
    1) This is a private email, and although the views expressed within it may not be purely my own, unless specifically referenced I do not suggest they are necessarily associated with anyone else including, but not limited to, my employer(s).
    2) This email has NOT been scanned for virii - attached file(s), if any, are provided as is. By copying, detaching and/or opening attached file
    s, you agree to indemnify the sender of such responsibility.
    3) Because e-mail can be altered electronically, the integrity of this communication cannot be guaranteed.
    >
    Copyright © 2004-2015 Christopher G. Relf. Some Rights Reserved. This posting is licensed under a Creative Commons Attribution 2.5 License.
    Attachments:
    Image_Browser-Selector_Example.llb ‏107 KB

  • Displaying .ICO images in web browser

    I have a need to display .ICO icon images within the browser. I'm finding that in MSIE they don't always work and in Firefox they display but they are very blurred. I'm wondering if anybody is aware of anything built into CF that might fix this problem? Possibly a flash component?
    CF never ceases to amaze me, it always has a tag or component for every issue, but this one might be a problem!
    Thanks
    Mark

    ACS LLC wrote:
     CF never ceases to amaze me, it always has a tag or component for every issue, but this one might be a problem!  
    Thanks
    Mark
    Yeah, since CF is a server technology and "I have a need to display .ICO icon images within the browser." kind of indicates that you are dealing with a client issue.
    I am fairly confidant that the <cfimage...> tag is not going to do anything with the .ico format.  At least I have never heard about it doing so.  It is possible that there is java code out there that could do something with the ico format that will make it work better.  If so, it should be pretty easy to inovke the java from within your CFML.

  • Display *.bmp images or *.tiff images

    Hi All,
    Need help in displaying *.bmp / *.tiff images at runtime.
    I am working in an application where the user may upload
    images (jsp) in any format (jpg/gif/png/bmp/tif) and I need to
    display these images from an user interface built in Flex with zoom
    effects. I am able to display jpg/gif/png using the standard Image
    control with zoom but unable to display the bmp and tiff files.
    Is there any way to display tiff and bmp files?
    Please help.
    Regards,
    Paromita

    All is well now. I used the Revo Uninstaller (www.revouninstaller.com) which scoured the registry and deleted dozens of left-behind pieces, then I reinstalled off the disk using all the default settings.

  • 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

  • Displaying a color image

    i am using the CCWIMAQViewer to display a .tiff image on a dialog application. I can display the image, but it is black and white. does anyone know how to display it in color?

    use the CCWIMAQVision class to create the image, then set the type to RGB, read the image file, and then attach the image object to the image viewer control.
    image=m_CWIMAQVisionObj.CreateCWIMAQImage();
    image.SetType(IMAQ_IMAGE_RGB);
    m_CWIMAQVision1.ReadFile(image, m_strPath + "\\myimage.tif", COleVariant((long)32), vOptional);
    m_CWIMAQViewerObj.Attach(image);

  • Activex image viewers to view multipage tiff images

    I have some multipage tiff images which i need to show up on forms. but the image item doesn't support multipage images. does any body know any other activex components which can replace image item and can display multipage tiff images. or is there any tricky way to show multipage images on oracle forms. thanks.

    where are your images in? file system or table?
    do you want to show one image at a time and navigate to another one or show multiple images at one time?
    in table, you may use query and next_record; in file system, you may read next file by read_image_file() eatch time clicking a button.

  • 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

  • When displaying images in web browser, next images appears on page where I left last doc

    Hello, I am in need of some help here.
    I have an application that displays PDF images using Adobe Reader X v 10.1.4 through a web browser. What is happening is I view a document and scroll down to say page 2.
    When I leave that document and go the next one, that document opens on page 2.
    Is there anything I can do in the setting of Adobe or the way that I am making my call to show the image through the web browser to display the next image at the top of the page, rather than displaying it where I left off on the last document?
    I have tried unchecking the option for Restore last view settings when reopening a document and also open cross-document links in the same window. Both of these had no effect on the issue I am encountering.
    Any help would be greatly appreciated.
    Thanks!
    Scott

    I am not sure how to fix the problem using the FGL framework, but here is a way to get the right result
    In the CSS file under the @media only screen and (min-width: 769px) section, modify the following style rules
    #menu {
        clear: both;
        float: left;
        margin-left: 0;
        width: 20%;
        display: block;
        vertical-align:top;
    #content {
        clear: none;
        float: right;
        margin-right: 0%;
        width: 80%;
        display: block;
    Having said that, you will do well to scrap FGL and have a look at Bootstrap

  • 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.

  • My 8530 does not display images in the browser

    My bb 8530 a few weeks ago suddenly stopped displaying images in the browser. Browser options are set to "display images". I've power cycled many times, even reset and wiped, but still no images in browser. How can I fix this? Thanks.

    hi i have noticed the same problem. also with Chrome and FP ver 11.5.31.2and Firefox and Safari with FP 11.5.502.110
    it seems that MovieClipLoader class not returning onLoadInit event. I use to add a fadein function on loadInit to fade in the loaded images. with the latest Flash PLayer versions this is not activated so you cannot see the loaded images.
    I have tested this on 3 different systems and the problem is the same. I have not updated my FP for IE. There, the older FP still works well.
    test systems
    Mac OS LionSafari and FP 11.5.502.110 --- DOES NOT WORK WELL
    Windows 7 64 bit
    chrome 23.0.1271.95 with FP 11.5.31.2  - DOES NOT WORK WELL
    Firefox 16.02 with FP 11.5.502.110  - DOES NOT WORK WELL
    IE 9 with FP version 11.4.402.287  - WORKS
    Windows XP SP3
    Firefox 16.02 with FP 11.5.502.110 - DOES NOT WORK WELL
    IE 8 wth FP 11.4.402.287  - WORKS
    chrome 23.0.1271.95 with FP 11.5.31.2  - DOES NOT WORK WELL

  • TIFF images are displayed as thumbnails but will not open for editing

    I have noticed a problem with my iPhoto 7.xx
    iPhoto displays the thumbnail of TIFF files but when it is selected (for editing as an example), iPhoto displays a grey circle with a black question mark. This happens with TIFF images from any source (multiple camera, scanner, etc). The TIFF files are NOT in raw format.

    Open the file with Preview and do a Save As. Either change the format or keep the tiff. That should fix the files so they can be viewed normally in iPhoto. If the problem is due to an alpha channel in the file this will fix the problem.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger or later), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 6 and 7 libraries and Tiger and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • Tiff images not display properly

    After installing iPhoto 6, none of the 1600 files in .tiff format imported via a Lexmark scanner are showing up correctly. (They worked perfectly well in iPhoto 5)
    I get a blurred scribbled squashed image a little like a TV channel that hasn't been set correctly.
    If I go back and click on the files in the Finder, they open beautifully in Preview.
    This lead me to believe there was an issue with the tiff-format and I promptly converted a copy of the files to jpegs.
    Unfortunately this left me with a new problem as three white lines now appear thru all the pictures in jpeg format.
    Luckily I never deleted or moved the .tiff files, so I am still hoping to use those.
    Will there be an Apple update which fixes this or will I have to re-scan and date/title- another (sigh) 1600 pictures? (please, someone tell me no)
    Best wishes,
    N

    I think I found the fix.
    As I mentioned in my previous post, I have also been having trouble with TIFF images and iPhoto 6.
    Today I downloaded the new iPhoto 6.01 update. But, that didn't fix the problem either. So much for Apple fixing it.
    Anyway, I have been experimenting, and finally found a difference between images that worked and those that didn't.
    The images that worked, have an ICC profile embedded in them from the device that created the image (in my case my scanner).
    So, I set out to find out if simply removing the ICC profile would fix the problem.
    And, through my experimenting, I found that if I opened the image in another program, and then exported it as either a TIFF (the same format) or a JPEG that the resulting image would open in iPhoto 6 just fine.
    Further examination demonstrated that the ICC information was removed from the exported file.
    As I understand it, ICC is basically an image color correction / calibration tag. It enables different devices to properly display and print the image with the proper colors.
    Basically, each device has a color profile (scanner, monitor, printer, camera, etc.). This is to make sure that when you see something on the screen that it looks the same as when you print it out. Likewise, you want the image on the screen to match what the scanner and digital camera saw.
    So, these are essentially conversion tables to make sure that each device properly displays or prints the image as the original source "saw" it.
    Anyway, not wanting to manually strip this information from each file, I looked on the Internet for an automated solution. And, fortunately I found one.
    http://www.colormanagement.com/technicalresources/files_targets_and_utilities/mac_os_xscripts/
    The file you are looking for is "Mac Os X ColorSync Toolbar Script: Remove ICC profile". Click on the title just mentioned to download the script.
    It is a Macintosh Script that you simply download to your desktop (or anywhere else you would prefer). It is in a Stuffit Archive, so you'll need Stuffit Expander to decompress it (basically the Mac equivalent of a ZIP file).
    Once decompressed, you should see a "script" icon that is labeled "Remove Profile".
    Simply "drag" your original files and drop them onto this icon / script. The script will then remove the embedded ICC information from the image file.
    Once you have removed the ICC information from your image's file, try importing it into iPhoto 6 again. Then, see if it works
    It is important that you perform this on a backup / duplicate copy of your original files. You don't want to damage your only copy if something goes wrong.
    Now, one further note: If you do this, you may see the image looks different. In my case, the image is truer to the way it really looked when I scanned it in. The paper texture looks right now.
    If you want to do this while keeping the image's appearance the same as it looks now, then here's another way:
    Open the file in Apple's "Preview" program. This is usually the default image view.
    Then, do a "Save As" or "Export" to create a new copy of the image. If you perform an Export, be sure to set the image quality high or you may inadvertently reduce your pictures detail (especially if you export to JPEG).
    This essentially does the same thing. But, it will take more work if you have multiple images.
    Using the previously mentioned script, you should be able to drag and drop multiple files in a group.
    Anyway, I hope this helps the rest of you out.
    Let me know if it fixes the problem for you as well.

Maybe you are looking for