Trying to determine the height and width of an image.

Hi Everyone,
I am currently trying to work out the height and width of a number of pictures. I have tried a couple of techniques. One involved using BufferedImages, which kept on throwing null pointer exceptions. So I am now tring to use the Image class from java.awt.Image. However I need to use an ImageObserver or some such thing, of which I have absolutely no knowledge. If there is anybody out there who knows how to gather the information I speak of from a number of photos, and is feeling kind enough to impart their knowledge to me it will be greatly appreciated. Thanks.

Well, maybe your problem is loading in the images, but I'm assuming you know what your question is since I don't feel like going into what ImageObserver does (That's what google is for).
Anyways, to get the height and width of an image you do this:
You initialize your image:
Image image = getImage("file.jpg")  //I don't remember the if this is correct, it's just my memory.To get the dimensions"
image.getHeight();If these return 0 it's more than likely because the image hasn't loaded correctly, which is why you need ImageObserver (IIRC there is a better API in the new ImageIO library, check the API).
Best of luck.

Similar Messages

  • How do I view the height and width of an image as I adjust the crop handles

    How do I view the height and width in pixels of an image as I adjust the crop handles before I actually crop the image?

    If you are in Photoshop CC, go into Preferences, click Interface, and turn on Show Transformation Values. In the picture below, setting it to Top Right means the pixel height and width appear to the Top Right of the Crop tool pointer.
    (Edit: The picture only shows Height because the bottom edge is being dragged. If a corner was being dragged it would say H and V.)

  • Dynamically changing the height and width of Stage

              I would like to know how can I change the height and width of stage dynamically. I tried it with the following code:
                             Stage.height = 250;
                             Stage.width = 250;
    during the run time. Initially the Stage is at a height and width of 370 and 450 respectively. Also when I tried to trace the height and width of Stage after resizing the stage width and height, its showing the old value of width and height. That means the width and height not chnaging. Anybody have any idea about this.

    Hi Ross,
                I could understand something about the problem after making a research on this topic. We can't change the width and height of stage from actionscript itself, right? I will explain the way I am planning to do. I don't know whether its right or not. Anyway you just go through it. First the player need to be resized, according to the specified height and width. Then in the object tag, there are two fields named height and width. We should change these value according to the specified height and width of video controller, dynamically. Am I right? But I am confused with two properties of Stage such as: align and scaleMode. The code was actually developed my trainer. There, the scaleMode is set to "noScale" and no align property is used. My doubt is how should I set align and scaleMode properties of Stage. Hope you understood what I meant.

  • Height and Width of an image

    Hello All,
    I wanted to fnd out the width and the height of an image (.jpg).
    Please could anybody let me know if there are any function modules or any other ways to find it out.
    Thanks and Regards,

    Hi Vikrant,
    I am using fileupload UI element.
    I wanted to determine the height and width of the image internally in webdynpro application, after which I can allow them to save.
    Thanks and Regards,
    Edited by: Sushmitha S on Jun 19, 2009 1:49 PM

  • The height and width settings no longer work.

    The settings in Adobe Photoshop CS5 have gone wacky in the canvas size area.  Everything shows as  0, whether it be inches, pixels, etc.  I tried entering numbers in place of the zeros in the height and width areas, and then it creates huge margins around the picture.  If I cut the number in half to try to trick it, it still gives big margins instead of cropping the picture.  HELP!

    THANK YOU!  I can't believe I've used Adobe all these years and never saw that box!  You have just made my life great again.

  • Set the height and width of a new browser window

    I am trying to open a new browser window when the user clicks
    on an audio. The audio will be played in the new browser window.
    The only problem I have is that I cannot set the height and width
    of the new browser window. I need the window to be much smaller.
    How can I do this in flash?

    You need to ask on a JavaScript forum. Java != JavaScript

  • Can I turn off the setting that displays the height and width in a little black box when using the marquee tool?

    In Photoshop CC, on a mac...
    When using the marquee selection tool, a little black box pops up next to the curser and displays in real time, the height and width of the selection.  The same annoying box also appears when dragging an item with the move tool, displaying the numerical location of the cursor.  Is there anyway to turn off the display of that little black box?  It is driving me bonkers.

    Under the preferences cmd/ctrl-k click on "Interface". At the bottom of the UI is a drop down box for show transformation. Set that to "Never"

  • How to change the height and width of a control?

    Dear all,
    is there anyway to change the height and width of a control?
     In the property nodes, i am just able to read the bound values but cudnt write to it.
    How can i set the bound values for a control?

    Not all controls can be sized this way. For example to change the vertical size of a simple numeric, you would need to change the font size.
    LabVIEW Champion . Do more with less code and in less time .

  • Increaseing the height and width of textfield and password fields

    Dear friends in apex 4.1 when we create a application it automatically creates a login page
    with username and password field in it
    So my question is can i increase the height and width of the username and password field in that login page
    If it is possible please help.
    and also i cannot find the html tag like <input type=text............>
    Where to find it?

    You can easily achieve this using css
    <input type="test" class="myclass" size="10">So in APEX you have to edit the textfield > HTML Form Eelement Attributes > put class="myclass"

  • What's the height and width of canvas3d

    what's the height and width of canvas3d

    I do not know if this will fully answer you question but:
    1) For a successfully executed Canvas3D, there should be a default size based on the system. If c3d is a Canvas3D object, try System.out.println( c3d ); This will given the Canvas3D object's ID, upper left corner location, and size (plus a possible status indicator whose meaning I do not fully understand). Also, the methods getSize(), getHeight(), getWidth() can be used to get the Canvas3D object's size.
    2) You can set the size and location of the Canvas3D object (which then can be added to some container of size W x H, e.g., JPanel) via:
    Canvas3D c3d;
    c3d.setSize(w, h); // where 0< w <= W and 0 < h <=H are preferred
    c3d.setLocation(x, y); // where 0 <= x <= W-w and 0 <= y <= H-h are preferred
    Note, the size and location can be set anytime after the Canvas3D object is declared/instantiated.
    I hope that the above is helpful.

  • How to resize and maintain height and width ratio IR image column

    Hello, I am upgrading from 3.2 to 4.1 reports that include images in report columns. I have had good success with this except for one thing. If the height and width is fixed it distorts the photos, and if I do not have fixed dimensions the image may be too large depending on the original dimensions of the :P1_PHOTO item which is File Browse... BLOB column. I do not want to restrict users ability to upload large image files, or files with different dimensions, but I want them to display as a thumbnail size proportional to the original dimensions in the report, or maybe I need a different approach? Report region template is No Template. I appreciate any suggestions.
    select decode(nvl(dbms_lob.getlength(photo),0),0,null,'<img src="'||apex_util.get_blob_file_src('P1_PHOTO',id)||'" height="75" width="75"/>') photo from table.
    I tried using percent i.e.: width="10%" that does not work.
    I have tried several variations of <style> in page HTML header to change column width, but the image size does not change.
    td[headers="PHOTO"] {
    #apexir_PHOTO{width: 75px;}

    Try to go with max-width / max-height. However, if you have IE browser, hang on for pain. For some ideas, some links: (ignore object-fit, it is not yet supported on most browser)
    etc. Be sure to try out your chosen solution on the target browser(s)!
    IE is just nasty :(
    What i have done before is not to have my browser scale my images, especially when the images can be large(r) and you expect quite some traffic. All those extra (kilo)bytes won't help it load faster. I just added an extra column in the table, like photo_thumb, and create a scaled version of the uploaded picture when it is being inserted.
    For example, i have the following process on my apex page, and i'm using wwv_flow_files.
    Have some code:
         v_id number;
         v_small_photo blob;
         v_large_photo blob;
         v_mime_type apxt_contacts_img.mime_type%type;
         v_content_type apxt_contacts_img.content_type%type;
          SELECT blob_content a, blob_content b, mime_type, content_type
          INTO v_small_photo, v_large_photo, v_mime_type, v_content_type
          FROM wwv_flow_files
          WHERE name = :P3_FIND_PHOTO;
          IF lower(v_mime_type) NOT IN ('image/jpg', 'image/jpeg') THEN
             raise_application_error(-20001, 'File for upload is not a jpg!');
          END IF;
          -- Rezise the photo so that it is proportionally 125*125
          -- ordimage is an oracle type able to manipulate all sorts of pictures
          ordimage.process(v_small_photo, 'maxScale=125 125');
          -- If contact is of type personnel, then no need to store
          -- a large photo since it wont be displayed
          IF :P3_CONTACT_TYPE_ID = 2 THEN
            v_large_photo := NULL;
          END IF;
          -- Delete previously uploaded picture
          IF :P3_ID IS NOT NULL THEN
             DELETE FROM apxt_contacts_img
              WHERE contact_id = :P3_ID;
          END IF;
          -- Insert the data into the contacts_img table as a
          -- SELECT from WWV_FLOW_FILES
          INSERT INTO apxt_contacts_img
          -- Remove the image from the apex wwv_flows_files table
          DELETE FROM wwv_flow_files WHERE name = :P3_FIND_PHOTO;
    END IF;

  • Changing the Height and Width of Multiple Cells

    Is there a way of selecting a group of cells and making them a specified height and width? It would make my life so much easier when producing large tables!
    Any help appreciated.
    Adam Colvin

    Hi Adam,
    Select the block of cells.
    Open the Inspector.
    Choose the Table inspector.
    Set the row height and column width using the appropriately labeled controls.

  • Height and Width of an image - URGENT!!!!

    how I make to catch the height and the width of an image being used one upload JSP?
    Since already I am thankful!

    Toss the image up in the air. Turn both of your hands so the palms face skyward and towards the image while keeping them next to each other. As the image descends into your palms, close both hands tightly around the image.
    No, seriously, what do you mean by catch the width and height of an image? I'm assuming you mean how does one determine the width and hieght, right? You can probably stream out of the posted request into a byte array which you could pass to a javax.swing.ImageIcon object. You could then call getIconWidth() and getIconHeight() to get what you want. This approach would work for GIFs and JPEGs.

  • Are the height and width (h and v) values switched?

    I have been exporting .avi video through the Export>>Movie dialogue box. My intended settings are for the width (v) to be 640 pixels and the height (h) to be 480 pixels with a square aspect ratio. I have found that after exporting there is a large black border on the top and bottom of the video.
    I have tried re-exporting it with different settings, and I have found that using 640 for the h (height) value and 480 for the v (width) value have solved the problem. IE, no excess black on the top and bottom. Is it just me or are the h and v values switched in Premiere? Meaning is the value for h actually v and vice a versa?

    You will also find links to many
    free tutorials in the PremiereProPedia that will quickly show you how things are done in Premiere Pro.
    PremiereProPedia   (
    RSS feed)
    - Over 300 frequently answered questions
    - Over 250 free tutorials
    - Maintained by editors like
    Forum FAQ

  • Changing the height and width of a pop-up

    I've run in to this script that sets these variables for the pop-up. Can someone please point me in the righ direction as to how to modify these variables? I've tried changing them and inserting a width and height in pixels, but the size does not change. I wish I had more time for Jave, but I've been spending most of my time with VB and It's very hard to keep up accross the board. Here is the code:
    <SCRIPT LANGUAGE="javascript">
    function calpopup(lnk, winHeight, winWidth, winTop, winLeft) {
    windowSpecs = "fullscreen=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,height=" + winHeight + ",width=" + winWidth + ",scrollbars=no,top=" + winTop + ",left=" + winLeft, "calendar",windowSpecs)
    <SCRIPT type=text/javascript>
    var win= null;
    function NewWindow(mypage,myname,w,h,scroll){
      var winl = (screen.width-w)/2;
      var wint = (screen.height-h)/2;
      var settings  ='height='+h+',';
          settings +='width='+w+',';
          settings +='top='+wint+',';
          settings +='left='+winl+',';
          settings +='scrollbars='+scroll+',';
          settings +='resizable=yes';,myname,settings);
      if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
    function SwapImage(clickedObject, newImage)
       clickedObject.src = newImage;

    You need to ask on a JavaScript forum. Java != JavaScript

Maybe you are looking for

  • Urgent help need please..

    hi all, can we select table as ( select * from tablename ) of another database. for ex: i had 2 databases 1.test1, 2.test2. i need to select particular table records of test2 database in test1 database. Is it possible. I connected to test2.I am givin

  • What is forms builder version for R12  ? prob. for 6i forms  ?

    hi..guys.. Currently we have oracle apps..11.5.10-----> forms version 6i Now, we are upgrading apps to all the custom forms which are in 6i needs to be migrated to forms 10g so they can be compatible with oracle EBS release 12. So, I am open

  • Framed-IP-Address in auth

    i have Cisco 7206VXR IOS 12.2(6c) setted up for pptp users and aaa (Radius) accounting... now i have to check source IP of the client during the authorization... But can't find it in auth packets. Only in start/stop/alive (Tunnel-Client-IP or somethi

  • Which function module is used?

    Hi all, The function module C1CA_SD_INTERFACE_TO_EHS_NEW is used to generate messages to the workflow inbox. From this function module how or which function module is used to get the information to the inbox documents.. Please reply to my above quest

  • Scriptlet objects scope

    Hello, I would like to be sure of one thing (arguing with someone ...) : I assume that objects declared in scriptlets are of page scope. Can somebody assure me on this ? Thank you,