Java Image Width

Discussion in 'Java' started by rickendall, Feb 2, 2004.

  1. rickendall

    rickendall Guest

    What units does the getWidth() method of the BufferedImage class
    return the width of an image in, I have a 2048x1536 pixel image loaded
    but it returns the width as 4194304.
     
    rickendall, Feb 2, 2004
    #1
    1. Advertising

  2. "rickendall" ...
    > What units does the getWidth() method of the BufferedImage class
    > return the width of an image in,


    pixels.

    >..I have a 2048x1536 pixel image loaded
    > but it returns the width as 4194304.


    Sounds like your image is either corrupt
    or at least suspect. Trty another image.

    --
    Andrew Thompson
    * http://www.PhySci.org/ Open-source software suite
    * http://www.PhySci.org/codes/ Web & IT Help
    * http://www.1point1C.org/ Science & Technology
     
    Andrew Thompson, Feb 2, 2004
    #2
    1. Advertising

  3. rickendall

    rickendall Guest

    > Sounds like your image is either corrupt
    > or at least suspect. Trty another image.


    This seems to be the case, for some reason every image that has been
    taken with a Minolta DImage Xt digital camera has the width and height
    stored incorrectly.

    Has anybody else experienced similar difficulties?
     
    rickendall, Feb 2, 2004
    #3
  4. "rickendall" ...
    > > Sounds like your image is either corrupt
    > > or at least suspect. Trty another image.

    >
    > This seems to be the case, for some reason every image that has been
    > taken with a Minolta DImage Xt digital camera has the width and height
    > stored incorrectly.


    Bad, bad camera.

    You might try the images in any old paint
    program. If they can load the images OK,
    save them to new names, that will probably
    fix the problem.

    There are probably 'bulk image processing'
    apps out there that could do the entire lot in
    a single pass.

    > Has anybody else experienced similar difficulties?


    Yes. It was only an occasional image, and it
    was long ago. I fixed them with the first
    suggestion above.

    HTH

    --
    Andrew Thompson
    * http://www.PhySci.org/ Open-source software suite
    * http://www.PhySci.org/codes/ Web & IT Help
    * http://www.1point1C.org/ Science & Technology
     
    Andrew Thompson, Feb 2, 2004
    #4
  5. rickendall

    nos Guest

    "rickendall" <> wrote in message
    news:...
    > What units does the getWidth() method of the BufferedImage class
    > return the width of an image in, I have a 2048x1536 pixel image loaded
    > but it returns the width as 4194304.


    Note: 2048 left shift 11 bits gives 4194304, so I think the width
    is actually stored in this shifted way. I have a hunch that if you
    look at the height and do an "and" with 0x7ff
    that your result will be 1536.

    int w = getWidth() >> 11;
    int h = getHeight() & 0x7ff;
     
    nos, Feb 3, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AndrewF
    Replies:
    1
    Views:
    841
    Bruce Barker
    Oct 10, 2005
  2. Xu
    Replies:
    11
    Views:
    8,656
    Andrew Thompson
    Jul 16, 2005
  3. Sean Jorden
    Replies:
    1
    Views:
    624
    laurie
    Aug 19, 2003
  4. kris
    Replies:
    11
    Views:
    900
  5. Replies:
    1
    Views:
    754
    Beauregard T. Shagnasty
    Dec 29, 2007
Loading...

Share This Page