Find out dimensional of loaded image

I have loaded image file . I want to find out width and height of desire image. My code are give below.
public function displayImage(imgPath:String,imgWidth:Number,imgHeigt:Number,imgXPos:Number,imgYPos:Number )
   var request:URLRequest = new URLRequest(imgPath);
   var loader:Loader = new Loader();
   loader.load(request);
   loader.x = imgXPos;
   loader.y = imgYPos;
   addChild(loader);
I think we can find your image dimentional after converting into movie clip. But still, I do not know how to convert loaded image into movie clip. Hope you would solve this problem. At last thanks for looking this problem

You can use loader info class for that.
Add an event listener on the loader:
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
Then:
public function onComplete(ev:Event):void
            var loader:LoaderInfo=LoaderInfo(ev.target);
            trace(loader.content.width);
            trace(loader.content.height);
Hope this helps

Similar Messages

  • How to find out resolution of an image?

    Hi, all
    Most common image formats (DIB, JPEG, PNG, TIFF and perhaps others) store the resolution of the image in pixels per inch (or other, similar units). I haven't found a way to find out this information using the Java libraries. Neither the AWT image classes nor the snazzy JAI classes seem to read & store this information, let alone make it public.
    Is there a way to determine the resolution, short of poking through the header of the image data myself?
    Thanks
    - rick

    Here's the solution (hopefully no one else ever has to track it down - the documentation is very well hidden by Sun).
                             ImageInputStream imageInput = ImageIO.createImageInputStream( fil );
                             Iterator it = ImageIO.getImageReaders(imageInput);
                             ImageReader reader = null;
                             while (it.hasNext()) {
                                  reader = (ImageReader) it.next();
                                  System.out.println(reader.toString());
                             reader.setInput(imageInput);
                             ImageReadParam param = reader.getDefaultReadParam();
                             BufferedImage bimg = reader.read(0, param);
                             IIOMetadata meta = reader.getImageMetadata(0);
                             org.w3c.dom.Node n = meta.getAsTree( "javax_imageio_1.0" );
                             n = n.getFirstChild();
                             while (n != null){
                                  if( n.getNodeName().equals( "Dimension")){
                                       org.w3c.dom.Node n2 = n.getFirstChild();
                                       String s1, s2;
                                       while (n2 != null){
                                            if(n2.getNodeName().equals("HorizontalPixelSize")){
                                                 org.w3c.dom.NamedNodeMap nnm = n2.getAttributes();
                                                 org.w3c.dom.Node n3 = nnm.item( 0 );
                                                 float hps = Float.parseFloat( n3.getNodeValue() );
                                                 xDPI = Math.round (25.4f / hps);
                                            if(n2.getNodeName().equals("VerticalPixelSize")){
                                                 org.w3c.dom.NamedNodeMap nnm = n2.getAttributes();
                                                 org.w3c.dom.Node n3 = nnm.item( 0 );
                                                 float vps = Float.parseFloat( n3.getNodeValue() );
                                                 yDPI = Math.round (25.4f / vps);
                                            n2 = n2.getNextSibling();
                                  n = n.getNextSibling();
                             }

  • Finding out hard drive load cycle count

    How can you find out the load cycle count of your hard drive? Is there a program that you must download?

    For reference, Hitachi's note on the subject
    http://tinyurl.com/mcx6t
    (above takes you to, for those where the long URL displays properly http://www.hitachigst.com/tech/techlib.nsf/techdocs/9076679E3EE4003E86256FAB0058 25FB/$file/LoadUnloadwhite_paperFINAL.pdf)
    One thing I did not know, but got from that article:
    "Parking the heads on the ramp, or “unloading” the heads,
    became the foundation of advanced power management
    modes including Active Idle, Performance Idle and Low
    Power Idle, implemented under Enhanced Adaptive Battery
    Life Extender™ (Enhanced ABLE). Usage of Enhanced
    ABLE can provide as much as a 20 percent reduction in
    power consumption at the drive level."
    So, disabling HD sleep should reduce load cycles, I'd guess, at the expense of draining the battery quicker.

  • Find out object in buffered image cature by JMF

    hi friends ..
    i doing one project in which i want to simulate real time object motion in java 2d ..
    for this using web cam i success fully capture image and buffered in pixel array ....
    now i want object coordinate to simulate it in 2d .. ..
    imagine human motion . and i want simulate it in form of human skeleton ... so make a skeleton i want coordinate
    and by change coordinate frame by frame .. i want to simulate it ..
    so suggest some thing relevant ..
    thanks in advance ..

    user5228856 wrote:
    the solution you give me l give me a all out report ,
    what i need is
    select <<>>
    from <<>>
    where object_name = owner.object_name
    result set should return what all db user has select priv on the given object.site below contains desired code
    http://www.petefinnigan.com/tools.htm

  • How to find out embedded raster image is Black&White or Color image?

    Is there any possibility to find out the embedded raster image is Black&White, Gray image (or) Color image in "illustrator cs3" without using color mode shown in "document info" pannel. Kindly advice me, the possibilities and solution. And also any scripts avilable for this?
    Thanks.

    Or you could select the embedded image, and open the Window>Document Info panel. Select Embedded Images from the fly out menu on the Document Info panel. This should give you the color mode and more info on the embedded file in question.

  • Problem loading image from jar file referenced by jar file

    First, I searched this one and no, I didn't find an answer. Loading images from jar files has been pretty much done to death but my problem is different. Please read on.
    I have my application, a straight up executable running from Eclipse. It uses a jar file, call it JarA. JarA launches a GUI that is located in another jar file. Call it JarB. To recap:
    My application calls JarA -> JarA loads classes from JarB -> JarB looks for images to place in a GUI it wants to show on the screen
    When JarB goes to load an image the following happens:
    java.lang.NullPointerException
         at sun.misc.URLClassPath$3.run(URLClassPath.java:316)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.misc.URLClassPath.getLoader(URLClassPath.java:313)
         at sun.misc.URLClassPath.getLoader(URLClassPath.java:290)
         at sun.misc.URLClassPath.findResource(URLClassPath.java:141)
         at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
         at java.lang.ClassLoader.getResource(ClassLoader.java:977)
         at org.cubrc.gmshell.gui.MainWin.preInit(MainWin.java:152)
         at org.cubrc.gmshell.gui.MainWin.<init>(MainWin.java:135)
    The code from JarB that loads the image looks like this:
              URL[] oSearch = {Main.class.getResource("images/")};
              URLClassLoader oLoader = new URLClassLoader(oSearch);
              imgIcon = new ImageIcon(oLoader.getResource("icon.gif"));
              imgMatchRunning = new ImageIcon(oLoader.getResource("gears.gif"));
              imgMatchStill = new ImageIcon(oLoader.getResource("gears-still.gif"));
              imgMagnify = new ImageIcon(oLoader.getResource("magnify.gif"));This looks right to me and JarB certainly has an images directory with those files. But I'm in hell right now because I don't know where to place the images to make this work or if you can even attempt to load images with a dependency chain like this.
    Any help very appreciated!

    Have you tried to move your image-files out of the jar file and place them in the sam folder as the jar-file? I think that would help.
    When you try to load the image-file you get the NullPointerException because the program tries to read a file it can't find. Remember that a jar file IS a file and not a directory.
    If you want to read somthing inside the jar-file you need to encode it first.
    Have you tried to read the jar-file with winRar. It makes it easy to add and remove files in your jar-file.

  • ImageIcon : How can I find out if image is loaded correctly?

    How can I find out if image is loaded coretly? (see example)
    private Image img;
    img = new ImageIcon("C:\image.jpg").getImage();
    If path is wrong, there is no exception or null in img.
    Thanks....
    Message was edited by:
    ptibull77

    also from the ImageIcon docs (note the ERRORED and ABORTED):
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/ImageIcon.html#loadImage(java.awt.Image)
    getImageLoadStatus
    public int getImageLoadStatus()Returns the status of the image loading operation.
    Returns:
    the loading status as defined by java.awt.MediaTracker
    See Also:
    MediaTracker.ABORTED, MediaTracker.ERRORED, MediaTracker.COMPLETE

  • How to find out image size (in pixels) of jpg and gif files

    this seems to work, though i doubt that it would very time:
                   Image img = Toolkit.getDefaultToolkit().getImage("car.jpg");
                   int w = img.getWidth(null);
                   int h = img.getHeight(null);
                   while(w <= 0 || h <= 0)
                      try{Thread.sleep(10);}catch(InterruptedException ix){}
                      w = img.getWidth(null);
                      h = img.getHeight(null);
                   JOptionPane.showMessageDialog
                      null,
                      filenames[i] + ": " + w + "x" + h,
                      "ImgSize",
                      JOptionPane.INFORMATION_MESSAGE
                   );please suggest a better solution.
    thanks

    >
    We've a requirement that we need to find out the size of a java object at run time, is there a direct java API to get the size of a composite object in memory?
    Here is my requirement: We are adding string objects (which is an xml string of considerable size) into a List. After reaching certain size limit (lets say 5MB) of the list i need to put this data into DB as a CLOB. So every time I add a string object to the list, I need to see if the total size of the list exceeds the limit and if yes, flush the results into DB.
    I am not sure if java has a direct API for this, if not what is the beast way to do it, it s critical requirement for us.
    It would be really great if someone could help us out.
    >
    Could you explain your actual requirement a little more fully.
    1. Is each individual string a separate XML string? Or is it just a fragment? Why would you just concatenate them together into a CLOB? That won't produce valid XML and it won't let you easily separate the pieces again later. So provide a simple example showing some strings and how you need to manipulate them.
    2. Are you using these xml strings in Java at all? Or are you just loading them into the database?
    For example if you are just loading them into the database you don't need to create a list. Just create a CLOB in Java and append each string to the CLOB. Before you append each one you can check to see if the new string will put you over your length limit. If it will then you write the CLOB to the database, empty the CLOB and start appending again to the new clob instance.
    If you explain what you are really trying to do we might be able to suggest some better ways to do it.

  • Finding out when page is loaded

    Im using setPage wit editorpane, just wondering how I find out when the page is fully loaded. Should I use threads?

    Nobody has found a way yet, that I've seen posted on the forum. A PropertyChangeEvent is fired when the initial page is loaded, but if that page needs to load images and stuff its creates a bunch of separate Threads to load the images. So no event is fired when everything is completely read.

  • How can I find out the dpi of an image in Acrobat.

    How can I find out the dpi of an image in Acrobat. I have tried the pre-flight option but I really don't understand the pixels width x depth information that I get. I basically just want to know at dpi of a single image. Is there other program that will read my pdf file and tell me this information.

    Thank you, tylerdurdain! That was ridiculously difficult to find. Not sure what version of Acrobat you're using in your image, but for those using Acrobat Pro 11 (in Mavericks), it's buried under View > Tools > Print Production.
    That opens a panel on the right.
    To keep from having to chase it down this way each time, right click on "Output Preview" and choose "Add to Quick Tools Toolbar". That adds a button to the top right of the toolbar.
    Now you can call up the inspector with one click. Choose Object Inspector as tylerdurdain shows above, then click on the item displayed to get its properties.

  • How do i find out the dpi of a an image on my i mac

    Can anyone please tell me how I find out the dpi of an image on my intel iMac?
    I dont have Photshop. I just need to lnow what the dpi is and if its not the right size then maybe make it bigger (if thats possible)
    Thanks,
    P

    If you are looking for a free alternative to Photoshop look at
    Gimp
    http://gimp.lisanet.de/Website/Download.html
    You can't just resize an image using Preview.
    Resizing an image will change its dimensions, but not the DPI/resolution.
    Images on the Internet are usually at computer screen resolution of 72 DPI. Some images in the web might be at 150 DPI depending on the type of website it is.
    Just resizing an image will make the image worst as you are only making the available pixels in the image larger and more spread out causing an even blurrier image.
    You need an image editor that will increase the number of pixels in an image as you increase the size.
    This is called interpolation. You are adding artificial pixels to an image to boost its DPI resolution.
    These pixels are created from the surrounding existing pixels in an image.
    Done correctly, you can get a pretty sharp image from a low DPI image.
    Done incorrectly, you can make the image very ugly, blurry and look very out of focus.
    You minimize this effect by  increasing the DPI of an image in small increments. I use 50 DPI increments.
    Some users use even smaller DPI increments like 25 DPI or smaller.
    I have a certain amount of impatience, so I use a larger upscale amount. I still get pretty good results that are more than just acceptable. Some user are just more particular about how much detail and sharpness they want their final image to be. I feel increasing the resolution of an image to 300-350 DPI using 50 DPI increments is a good compromise. My own user preference.

  • How can you find out an individual image size from multiple images on a canvas

    This is probably a really really simple question but I can't for the life of me find how I can find out an individual image size from multiple images on a canvas. eg I have 3 photos i want to arrange 1 large and the other two next to it half the size. How can I edit individual image size on the canvas as when I select the image on a sperate layer I want to resize it just resizes the entire canvas and not the individual image
    Thanks

    I want to know they exact dimensions though. You can get them by dragging to the 0,0 corner and then reading off of the ruler scale on the sides but its fiddily as you have to zoom right in and work it out. I know in photoshop there is a ruler but is there any other way in Elements?

  • How do I find out the exact path of each and every file that LabVIEW finds and loads into memory for a given top level vi?

    How do I find out the exact path of each and every file that LabVIEW finds and loads into memory for a given top level vi? There is probably a trivial, easy way to get this info, but I have not yet found it!  Thanks..

    Or if you want to grab all the paths programatically, try the attached VI.
    Open the top level that you want all the paths from and close all others, then open the
    attached and run it. It will return an array of all the VIs that the VI
    in question uses, including vi.lib VIs. You can filter these as well if
    you like.
    Ed
    Message Edited by Ed Dickens on 08-01-2005 07:01 PM
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
    Attachments:
    Get all paths.vi ‏29 KB

  • How to find out the image size?

    How to find out the image size values(Width and height) in illustrator CS3 using any script. I tried but i got only the document height and width. I need to find out the image BoundingBox value of width and height. Kindly advice me.

    Try this.
    tell application "Adobe Illustrator"
    set heightImage to get height of raster item 1 of current layer of current document
    set widthImage to get width of raster item 1 of current layer of current document
    display dialog (heightImage & " X " & widthImage) as string
    end tell
    JaiMS

  • How to find out the image resolution in illustrator?

    How to find out the image resolution in illustrator cs through javascript or vbscript?
    Thanks,
    Prabudass

    Anyone please help me, how to find out the embedded image resolution in illustrator file through script.
    Thanks,
    Prabudass

Maybe you are looking for

  • Imac G5 lcd pressure spots

    Is this normal? since the day I brought it home I have noticed a slight fog or what seems to be "pressure" on the four sides of the screen. Is this covered under warranty? In the dark it is more noticable.

  • Small DC Switch Design

    Hello, I'm working on options for a small DC switch design.  This DC has 5 virtual hosts with 10-20 guest vm's each.  Each server has two quad port gig nics with 6 of the 8 gig ports connected (3 for iSCSI and 3 for data or management.  It also has t

  • How can i find a contact i deleted from my phone?

    how can i get a phone number i deleted from my phone back?

  • N900 802.11 connectivity issues

    I've had my N900 for just over a week now and have had no issues with it until yesterday.  Since I'm an AT&T user in the US, I don't have 3G support, so when I'm at home I have it autoconnect to wifi and use that around here.  Yesterday it started wh

  • Nikon D5200 and old LR versions?

    I have purchased the Nikon D5200 and want to use Lightroom to edit my images. Will the older versions of Lightroom have the built in presets to cope with the distortion that is often seen at the wider angles with the Nikon? If not, what is the oldest