Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java Image Width

Reply
Thread Tools

Java Image Width

 
 
rickendall
Guest
Posts: n/a
 
      02-02-2004
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.
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      02-02-2004
"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


 
Reply With Quote
 
 
 
 
rickendall
Guest
Posts: n/a
 
      02-02-2004
> 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?
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      02-02-2004
"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


 
Reply With Quote
 
nos
Guest
Posts: n/a
 
      02-03-2004

"rickendall" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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;


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! Fixed width table with a 100% width image in it is assuming theimages intrinsic size, although it does shrink the image satya.komatineni@gmail.com HTML 1 12-29-2007 08:32 PM
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM
JComboBox width, dropdown list width Xu Java 11 07-15-2005 11:54 PM
Table width and columns width kris HTML 11 11-18-2003 06:49 AM
Re: resized image in table extends table width to original image width Sean Jorden HTML 1 08-19-2003 08:59 AM



Advertisments