Loading tiff image file

Hi, I'm trying to load a tiff image onto my GUI and having difficulties carrying out this task. At the moment it reads the image file successfully but can't display the image on the GUI. Does anyone know of any java packages or method i could declear within my program code to solve this problem. Thanks
Regards
Osagie

so display it like this:BufferedImage image = ImageIO.read(file);
ImageIcon icon = new ImageIcon(image);
label.setIcon(icon);But are you sure that you are reading the tiff file correctly? In my machine ImageIO.getReaderFormatNames() outputsBMP,jpeg,bmp,wbmp,gif,png,JPG,jpg,WBMP,JPEGwhich means that tiff files are not supported

Similar Messages

  • A generic error occurred in GDI+ while assing tiff image file to Bitmap and Image

    Hi,
    I am getting "A generic error occurred in GDI+" error while reading the tiff image file to Bitmap or Image.
    Below is my sample code.
    string filePath=@"c:\Images\sample.tif";
    Bitmap bmp=new Bitmap(filePath);   // here getting exception
    int totalpages=bmp.GetFrameCount(.....);
    etc......
    I tried using Bitmap.FromFile() and also from FromStream() even for Image also but there is no use.
    Moreover i m having full permissions for the file path and the tiff file is having multiple pages.
    Can anyone help me to solve this issue please.
    Thanks & Regards,
    Kishore
    Kishore

    Make sure that the Tif file is valid (can other software open it)?  If you are able to save a Tif using GDI+, try saving that Tif, then opening it.  Part of me wonders if there is something about that specific Tif that GDI+ doesn't like.
    You could also try using WIC to open the TIF, perhaps you would have better luck there.

  • Accessing a page in a tiled Tiff image file

    hi all
    I have a tiled tiff image file containing 10 images,please tell me how to process a specific image say 7th image using ordImage process method ,I am using oracle 8.1.7 and win 2000.
    regards
    Ravi Kiran

    Having multiple images in a tiff file is probably not the best practice. THe image object meta data might not make much sense (width, height, format...).
    But....
    For 8.1.7, there is no way to do it from PL/SQL. You could do it outside the database in a servlet.
    For 9i, there is an undocumented interface to allow for access to tiff images other than the first image that is being considered for documentation with 10i.

  • Load JP2 image file with GeoRasterLoader

    Hi to all,
    We are trying to set up Oracle GeoRaster tools (stand-alone client-side java Executables found in %ORACLE_HOME%\md\...) in order to view and load JP2 image files to Oracle.
    Our test environment has Oracle 11g r2 (11.2.0.3.0) EE with Spatial Option on Microsoft Windows XP Professional 2002 SP3.
    Following the instructions for loading JP2 we download and install jai_imageio-1_1-lib-windows-i586.exe from: http://download.java.net/media/jai-imageio/builds/release/1.1/
    1.     Please find an example of the command we use to invoke GeoRasterLoader from command line:
    java oracle.spatial.georaster.tools.GeoRasterLoader SE004 ORCL 1521 RD RD thin 32 T OKXE_ORTHOS GEORASTER "blocking=true blocksize=(256,256,3) spatialExtent=TRUE" "C:\Temp\0458041985\0458041985.jp2,1,OKXE_ORTHOS_RDT,C:\Temp\0458041985\0458041985.j2w,2100"
    Got connection
    Loading image: C:\Temp\0458041985\0458041985.jp2
    java.lang.NullPointerException
    at oracle.spatial.georaster.rasterio.JGeoRasterAdapter.setSRS(JGeoRasterAdapter.java:4509)
    at oracle.spatial.georaster.rasterio.JGeoRasterAdapter.setMetadataStream(JGeoRasterAdapter.java:4520)
    at oracle.spatial.georaster.rasterio.JGeoRasterAdapter.storeFromStream(JGeoRasterAdapter.java:4921)
    at oracle.spatial.georaster.rasterio.GeoRasterAdapter.doImport(GeoRasterAdapter.java:632)
    at oracle.spatial.georaster.rasterio.GeoRasterAdapter.loadFromFile(GeoRasterAdapter.java:1863)
    at oracle.spatial.georaster.tools.GeoRasterLoader.load(GeoRasterLoader.java:458)
    at oracle.spatial.georaster.tools.GeoRasterLoader.main(GeoRasterLoader.java:243)
    java.lang.NullPointerException: null
    The georaster object is not loaded correctly!!
    Loader Finished.
    2.     When using the GeoRaster Viewer for retrieving jp2 file from file we get an error message “ Can’t load Image” The error messages that appear in the command prompt are as follows:
    C:\Oracle\product\11.2.0\dbhome_1\md\demo\georaster\java>java -Xms128m -Xmx564m oracle.spatial.georaster.tools.GeoRasterTool
    java.lang.RuntimeException: - Unable to render RenderedOp for this operation.
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:827)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
    at javax.media.jai.RenderedOp.getWidth(RenderedOp.java:2179)
    at oracle.spatial.georaster.tools.GeoRasterTool.actionPerformed(GeoRasterTool.java:1471)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1051)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1092)
    at java.awt.Component.processMouseEvent(Component.java:5517)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
    at java.awt.Component.processEvent(Component.java:5282)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3984)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3819)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
    at java.awt.Container.dispatchEventImpl(Container.java:2010)
    at java.awt.Window.dispatchEventImpl(Window.java:1791)
    at java.awt.Component.dispatchEvent(Component.java:3819)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    PS. He have no problems in viewing and loading other type of image files like tif
    TIA,
    George

    Hi Tomek,
    3 to 4 MB with the following image header. Anyway, we also tried jp2 image files from other sources
    Thanks,
    BR / George
    Output from Display Header
    File Name: I:\Okxe\Orthos_June\0438042165\0438042165.jp2
    File Information:
    Standard : : Jpeg 2000 File
    Format : Lossless JPEG 2000 compression
    Pixels per Line : 1600
    Number of Lines : 1200
    Samples per pixel : 3
    File bits per sample : 8
    Actual bits per sample : 8
    Untiled file
    Number of overviews : 5
    Overview sampling method: Gaussian
    Scanning device resolution : 84 : microns
    Orientation : 4 : Row major order, origin at top left
    NO scan line headers : non-scannable file
    Packet size (16-bit words) : 0
    Free vlt space (16-bit words) : 0
    Free packet space (16-bit words) : 0
    Raster to UOR matrix:
    Identity Matrix (ones on the diagonal, zero otherwise)
    Raster to World Matrix:
    Units: Unknown or Unspecified
    amx[ 0]= 0,25, amx[ 1]= 0, amx[ 2]= 438000
    amx[ 3]= 0, amx[ 4]= -0,25, amx[ 5]= 4216800
    438000 , 4216800
    438400 , 4216800
    438400 , 4216500
    438000 , 4216500
    Geotiff_Information:
    Version: 1
    Key_Revision: 1.0
    Tagged_Information:
    ModelTiepointTag (2,3):
    0 0 0
    438000 4216800 0
    ModelPixelScaleTag (1,3):
    0.25 0.25 0
    End_Of_Tags.
    Keyed_Information:
    GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
    End_Of_Keys.
    End_Of_Geotiff.
    Corner Coordinates:
    Upper Left ( 438000.000, 4216800.000)
    Lower Left ( 438000.000, 4216799.750)
    Upper Right ( 438000.250, 4216800.000)
    Lower Right ( 438000.250, 4216799.750)
    Center ( 438000.125, 4216799.875)

  • Opening tiff image file and finding pixel values at each point

    I want to open a tiff image file using java.Than i want to find out the pixel values at each point.Also if possible red,green and blue values.
    please mail me answer or code if possible on mail id:
    [email protected]

    Use Java Advanced Imaging to open the Tiff. There is
    a tutorial on it. Look to the left for tutorials, look
    for JAI, do what it says.
    For getting the pixels, do this:
    Use a PixelGrabber to get pixels in array:
    int[] pixels = new int[w * h];
    PixelGrabber pg = new PixelGrabber(img, x, y, w, h, pixels, 0, w);
    pg.grabPixels();
    Use a MouseMotionListner for
    mouseMoved(MouseEvent moueEvent)
    pixel = pixels[mouseEvent.getX() + (mouseEvent.getY()*width)]
    int alpha = (pixel >> 24) & 0xff;
    int red = (pixel >> 16) & 0xff;
    int green = (pixel >> 8) & 0xff;
    int blue = (pixel ) & 0xff;
    Look up the API for MouseMotionListener, PixelGrabber, etc...

  • Why when i connect my phone to my laptop do my recent photos load as image files and not jpeg

    why is it that when i connect my phone to my laptop my recent photos load
    as image files and not jpeg as they used to.Is this another issue with ios 8

    Thank you. I did that and made sure my phone was open to the camera roll. I was able to locate the import command and the photos appeared. Thanks so much!

  • How to load tiff image in flash 8

    hi all
    Is it possible to load a tiff image in flash 8. i am creating
    a flash image viewer using ASPX and Flash ... and i need to load a
    tiff images but flash is not supporting to load a tiff images. is
    there is any way to do this...
    thanks in advance
    Sankar

    Thanks FlashTastic
    Any other way to Load tiff into flash using third party
    tools....if its so please send me link or files to me..
    Thanks and Regards
    Sankar

  • How to remove flickering in a animation done by loading different image files

    Hello Everyone,
    I have done a character animation by loading multiple images one after another at runtime or dynamically by accessing files from there path directly.
    But the problem I am facing is, I am getting a white bg or delay when the images change, it kind of feels like the images are flickering. How can I get rid of this flicker.
    Thank you.
    Iceheros

    When loading images from a server during runtime you can never be sure that there will be no delay.
    What you could do is write a function, that checks with a progress Event how much of the next picture is loaded and base the percentage of the current pictures alpha channel on this figure.
    Say the progressEvent from your Loader returns a number like 0.1....1.0 (10%...100% of the next picture are loaded)
    Then in an eneterframe you could use that number to modify the current Pictures alpha (like img.alpha = 1.0- progress);
    A clear disadvantage is, that the tweens will always be different (depending on picture size/network traffic)

  • Loading PNG image file from Applet?

    Hi All,
    My applet running on IE6 and it will often loads 100 PNG image files from a webserver.
    Size of PNG file is about 60Kb so 100*60=6000 Kb ~ 6M.
    In theory, the applet will took 6M of memory to store all 100 files. In practical, it tooks about
    6M* 25 = 150M of memory, that make my applet run in out of memory sometimes.
    I know the reason, may be the brower/applet convert the PNG file format to BMP file format before showing on the screen.
    So the main point here is the applet should not loads all 100 files into the memory,
    it should loads only 10 files at the same time, another 90 files should be cached in memory as PNG file format, not BMP image file format to save the memory usage.
    Is this solution possible in applet field?
    If it is possible how can I implement it?
    And please show me better solution if anys.
    Many Thanks.

    I know the reason, may be the brower/applet convert the PNG file format to
    BMP file format before showing on the screen.This sounds VERY unlikely! Why should the browser do that? And the applet does what you have coded I hope!
    Your problem is probably somewhere else. And it has nothing to do with applets I presume. Use a heap analyzer tool to find out what hogs the memory. A thorough code review can't hurt either. If you still thinks it is the images though, then just don't load them all at once then.

  • Why can't I load the image files in the Jar file?

    I make an application in a structure bellowing:
    A.class
    images\a.gif
    images\b.gif
    and I packed all of them(include the images directory) into a A.jar file.
    when I run the A.jar file,the application can't load the images in the Jar file.
    How can I do to solve this problem?

    It isn't working. The URL that is returned is blank. I tried rearanginf my stuff a little. Now it is set up like the other guys. So all the classes aren't in a package. so its:
    MyClass.class
    Sounds/mysound.wav
    all of this is in a .jar file. If it isnt in a .jar file it works. Bit I have mor than one class so I would really like it in a .jar file. But when it is MyClass.class.getResource("sounds/mysound.wav") returns nothing. Not null. Just blank.

  • Reading Tiff image files

    Can anybody help me to find out any freeware tools or api to read an image file in tiff format.
    The content of tiff file is all text and I have to convert all tiff files into .txt file.
    Any help would be appreciated.
    -R

    Try JAI. A good place to learn how to read files is at http://java.sun.com/j2se/1.4.2/docs/guide/imageio/spec/title.fm.html

  • Problem with loading big image files in 1.4

    Hi, I recently discovered that after updating my jdk from 1.3 to 1.4, my application seems to be failing to display image files over 300kbytes, or at least the display is corrupted.
    Originally I have a gif file over 300k (2048X512 pixels) and the display got corrupted, but when i reduced the file (1024X512) the display did not corrupt.
    Is there any way other than to cut the filesize of the image??
    ~Jeffrey

    I know that focus management has changed alot.
    Based on my experimentation a while back, in 1.4 it still believes that the JFrame is the window in focus, even though a JOptionPane is currently in front of it (unless I misinterpreted what was going on). Thus, the frame seems to get the keyboard event and re-invoke the action.
    A.F.

  • Load local image file to database on web

    Read_image_file works fine in client side. but it does not work on the web, can somebody find the way to save image from image file in client PC to Oracle database (or to webserver directory) when run on web.
    Thanks
    Frank
    null

    You may find the following articles useful for the JSP/Servlet part:
    Uploading files: http://balusc.blogspot.com/2007/11/multipartfilter.html
    Downloading files: http://balusc.blogspot.com/2007/07/fileservlet.html

  • Cant Load Disk Image files

    Verify and Repair disk “StreetAtlas_USA4.0.img”
    Checking HFS volume.
    Checking Extents Overflow file.
    Checking Catalog file.
    Invalid extent entry
    Incorrect block count for file
    Checking Catalog hierarchy.
    Checking volume bitmap.
    Volume Bit Map needs minor repair
    Checking volume information.
    The volume The volume asUSA4.0 needs to be repaired.
    Error: The underlying task reported failure on exit
    1 HFS volume checked
    1 volume could not be repaired because of an error
    1 HFS volume checked
    1 volume could not be repaired because of an error

    I tried repairing the disk image from within the Finder. Install disc? You mean the boot DVD? As far as I understand the finder cant be loaded in OSX from a boot CD, like it could be done in OS 9 and earlier.
    I do have Tech Tools Pro, perhaps I need to use it, as I do not want to create a new disc image from that CD.
    They no longer make Street Atlas for the Mac, so I need classic to run that CD. Its really useful for those that are traveling and without Internet access, and for those that want very detailed maps that MapQuest, Google, or whatever usually cant provide.
    Okay should I try repairing the disk with Tech Tools Pro?
    John

  • Help loading an image file

    Hi, I have an image on my movie that I am now able to move around and resize. What I want now is to replae this image with a different one (ie. user's own logo) by displaying a file browser window when user clicks on the current image.
    My actual image is "your_logo.png". Please bear in mind I am VERY new to Flash Builder. Here´s my code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application 
    xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="
    library://ns.adobe.com/flex/spark" xmlns:mx="
    library://ns.adobe.com/flex/mx" width="
    874" height="700">
    <fx:Script>
    <![CDATA[
     import mx.controls.Alert; 
    import mx.events.FlexEvent; 
    import mx.managers.CursorManager; 
    Bindable][
    Embed(source="images/moveCursor.png")] 
    private var myCursorIcon:Class; 
    protected function clickHandler(event:MouseEvent):void{
    CursorManager.setCursor(myCursorIcon);
    protected function resetHandler(event:MouseEvent):void{
    CursorManager.removeAllCursors();
    // esta función hace que al reducir y ampliar imágenes, estas no se distorsionen 
    private function smoothImage(evt:Event):void{ 
    var myBitmap:Bitmap = ((evt.target as Image).content as Bitmap); 
    if (myBitmap != null) {myBitmap.smoothing =
    true;}
    // esta función hace que podamos manipular el tamaño del texto con un slider. Una para cada texto. 
    protected function resizeMyName_changeHandler(event:Event):void{
    // TODO Auto-generated method stubMyName.textFlow.fontSize = resizeMyName.value;
    protected function resizeMyAddress_changeHandler(event:Event):void{
    // TODO Auto-generated method stubMyAddress.textFlow.fontSize = resizeMyAddress.value;
    protected function resizeMyPhone_changeHandler(event:Event):void{
    // TODO Auto-generated method stubMyPhone.textFlow.fontSize = resizeMyPhone.value;
    protected function resizeMyFax_changeHandler(event:Event):void{
    // TODO Auto-generated method stubMyFax.textFlow.fontSize = resizeMyFax.value;
    protected function resizeMyMobile_changeHandler(event:Event):void{
    // TODO Auto-generated method stubMyMobile.textFlow.fontSize = resizeMyMobile.value;
    protected function resizeMyEmail_changeHandler(event:Event):void{
    // TODO Auto-generated method stubMyEmail.textFlow.fontSize = resizeMyEmail.value;
    protected function resizeMyWebsite_changeHandler(event:Event):void{
    // TODO Auto-generated method stubMyWebsite.textFlow.fontSize = resizeMyWebsite.value;
    ]]>
    </fx:Script>
     <s:BorderContainer x="10" y="10" width="853" height="680" backgroundColor="#F0EEEE">
     <s:BorderContainer 
    width="
    630" height="
    394" x="
    33" y="170" borderVisible="
    true" dropShadowVisible="
    true" borderColor="#E1E1E1">
     <s:layout>
     <s:BasicLayout/>
     </s:layout>
     <s:RichEditableText id="
    MyAddress"text="
    my address here" fontSize="
    12"mouseDown="MyAddress.startDrag();"
    mouseUp="MyAddress.stopDrag();"
    mouseOut="resetHandler(event)"
    mouseOver="clickHandler(event)"
    x="
    114" y="64" fontFamily="Verdana" textAlign="right" 
    />
     <s:RichEditableText id="
    MyWebsite"text="
    my website here" fontSize="
    12"mouseDown="MyWebsite.startDrag();"
    mouseUp="MyWebsite.stopDrag();"
    mouseOut="resetHandler(event)"
    mouseOver="clickHandler(event)"
    x="
    115" y="158" fontFamily="Verdana" textAlign="right"/>
     <s:RichEditableText id="
    MyPhone"text="
    my phone here" fontSize="
    12"mouseDown="MyPhone.startDrag();"
    mouseUp="MyPhone.stopDrag();"
    mouseOut="resetHandler(event)"
    mouseOver="clickHandler(event)"
    x="
    125" y="82" fontFamily="Verdana" textAlign="right"/>
     <s:RichEditableText id="
    MyFax"text="
    my fax here" fontSize="
    12"mouseDown="MyFax.startDrag();"
    mouseUp="MyFax.stopDrag();"
    mouseOut="resetHandler(event)"
    mouseOver="clickHandler(event)"
    x="
    146" y="99" fontFamily="Verdana" textAlign="right"/>
     <s:RichEditableText id="
    MyMobile"text="
    my mobile here" fontSize="
    12"mouseDown="MyMobile.startDrag();"
    mouseUp="MyMobile.stopDrag();"
    mouseOut="resetHandler(event)"
    mouseOver="clickHandler(event)"
    x="
    124" y="116" fontFamily="Verdana" textAlign="right"/>
     <s:RichEditableText id="
    MyEmail"text="
    my email here" fontSize="
    12"mouseDown="MyEmail.startDrag();"
    mouseUp="MyEmail.stopDrag();"
    mouseOut="resetHandler(event)"
    mouseOver="clickHandler(event)"
    x="
    132" y="133" fontFamily="Verdana" textAlign="right"/>
     <s:RichEditableText id="
    MyName"text="
    my name here" fontSize="
    24"mouseDown="MyName.startDrag();"
    mouseUp="MyName.stopDrag();"
    mouseOut="resetHandler(event)"
    mouseOver="clickHandler(event)"
    x="
    50" y="23" fontFamily="Verdana" textAlign="right" 
    />
     <mx:Image x="289" y="
    289" source="
    images/your_logo.png"mouseDown="img1.startDrag();"
    mouseUp="img1.stopDrag();"
    mouseOut="resetHandler(event)"
    mouseOver="clickHandler(event)"
    id="
    img1"complete="smoothImage(event)"
    />
     </s:BorderContainer>
     <s:BorderContainer x="11" y="10" width="830" height="114" borderVisible="true" cornerRadius="20" borderColor="#D4D4D4">
     <mx:Image x="20" y="
    7" source="
    images/logo_construction.png" 
    />
     </s:BorderContainer>
     <s:HSlider x="
    711" y="
    235" minimum="
    100" maximum="
    350"change="img1.width=event.currentTarget.value"
    liveDragging="
    true" value="
    350" stepSize="10" id="resizeLogo"/>
     <s:Label x="711" y="
    190" text="
    RESIZE" fontWeight="
    bold" fontFamily="
    Verdana" fontSize="
    10"/>
     <s:Label x="712" y="
    252" text="
    my name" fontWeight="
    normal" fontFamily="
    Verdana" fontSize="
    10"/>
     <s:Label x="712" y="
    222" text="
    logo" fontWeight="
    normal" fontFamily="
    Verdana" fontSize="
    10"/>
     <s:HSlider x="
    711" y="
    264" value="
    24" stepSize="
    2" maximum="
    24" minimum="
    14" id="
    resizeMyName"liveDragging="
    true"change="resizeMyName_changeHandler(event)"
    />
     <s:HSlider x="
    712" y="
    296.15" value="
    12" stepSize="
    1" maximum="
    18" minimum="
    12" id="
    resizeMyAddress"change="resizeMyAddress_changeHandler(event)"
    />
     <s:HSlider x="
    712" y="
    324" value="
    12" stepSize="
    1" maximum="
    18" minimum="
    12" id="
    resizeMyPhone"change="resizeMyPhone_changeHandler(event)"
    />
     <s:HSlider x="
    712" y="
    353" value="
    12" stepSize="
    1" maximum="
    18" minimum="
    12" id="
    resizeMyFax"change="resizeMyFax_changeHandler(event)"
    />
     <s:HSlider x="
    712" y="
    380" value="
    12" stepSize="
    1" maximum="
    18" minimum="
    12" id="
    resizeMyMobile"change="resizeMyMobile_changeHandler(event)"
    />
     <s:HSlider x="
    712" y="
    406" value="
    12" stepSize="
    1" maximum="
    18" minimum="
    12" id="
    resizeMyEmail"change="resizeMyEmail_changeHandler(event)"
    />
     <s:HSlider x="
    712" y="
    432" value="
    12" stepSize="
    1" maximum="
    18" minimum="
    12" id="
    resizeMyWebsite"change="resizeMyWebsite_changeHandler(event)"
    />
     <s:Label x="712.5" y="
    284.15" text="
    my address" fontWeight="
    normal" fontFamily="
    Verdana" fontSize="
    10"/>
     </s:BorderContainer></s:Application>

    Kokorito I have added this to my code:
    proteced var fileRef:FileReference;fileRef =
    new FileReference();fileRef.addEventListener(Event.COMPLETE,loadComplete);
    fileRef.load();
    img1.source = fileRef.data;
    but I get  the following message:
    1004: Namespace was not found or is not a compile-time constant.
    Am I missing something?

Maybe you are looking for