Results 1 to 2 of 2
  1. #1
    trishtren is offline Member
    Join Date
    Feb 2011
    Posts
    53
    Rep Power
    0

    Default Image data pre drawing

    Hey, iv been wondering for a way to load an image but not draw the image onto the canvas but still retrieve data about its height, width etc. After trying it a few times iv found that the standard way of loading an image seems to only return the height and width data if it has been drawn to the canvas.

    BufferedImage img = null;
    try {
    img = ImageIO.read(new File("strawberry.jpg"));
    } catch (IOException e) {
    }

    Does anyone know what i should look into to store images or buffer images without having to display them and still be able to tell their size/ how much of the image data has been loaded/buffered? Any help to push me in the right direction would be appreciated :)

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default

    Have you looked at the API for BufferedImage? It contains methods for retrieving the width and height values

Similar Threads

  1. Drawing an image on JPanel
    By mneskovic in forum New To Java
    Replies: 3
    Last Post: 05-20-2010, 02:58 PM
  2. Replies: 1
    Last Post: 04-17-2009, 01:44 AM
  3. Drawing a shape on an image
    By Yoruichi in forum Java 2D
    Replies: 2
    Last Post: 03-29-2009, 03:49 PM
  4. Drawing on an image
    By kratra in forum New To Java
    Replies: 0
    Last Post: 02-06-2009, 09:58 PM
  5. drawing an image to an offscreen image
    By hunterbdb in forum Java 2D
    Replies: 9
    Last Post: 10-30-2008, 07:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •