This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes How to make images the right size? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to make images the right size?" Watch "How to make images the right size?" New topic
Author

How to make images the right size?

Ricardo Estafan
Ranch Hand

Joined: Mar 29, 2004
Posts: 84
Hello all,

i have an issue concerning html/webdesign. Let's say i have a collection of images of which i don't know the size. I iterate over the collection to display the images. These images can be in all shapes and sizes. Is it possible to resize these images in order for them to be displayed on the screen properly?? So that one image will not take up the full screen and another will be hardly vissible.

Thanks for the info.

P.S. perhaps i can give the user the possibility to click on a link which generates a popup containing the image, so resizing will be no issue. But i prefer to show the images immediately.
Eugene Lucash
Ranch Hand

Joined: Feb 19, 2005
Posts: 77
you can set fixed width="" and height="" attributes on <img> tag but images will be resized roughtly (by the browser).
Ricardo Estafan
Ranch Hand

Joined: Mar 29, 2004
Posts: 84
I know you can set fixed width and height, but if you don't know the shape of an image it is not possible to set width and height fixed. In that you never know what the result will be. This can be a rather awkward image if you set the width and height fixed.
Eugene Lucash
Ranch Hand

Joined: Feb 19, 2005
Posts: 77
Images of different shapes.. let me think round, triangle, star-shaped

you can align (lineup) them for example by height

<img src="ttt.gif" height="100" alt="ttt" />
<img src="vvv.gif" height="100" alt="vvv" />

ttt.gif and vvv.gif a different sized and with different aspect ratio
but they appered in same height preserving aspect ratio

If you want some smarter aligning it is not trivial task.
Your program will need more artifical intelligence...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make images the right size?
 
Similar Threads
How to decrease image weight?
Image insertion into database
Porting
Supported Image Types
Best packaging strategy for 'image apps'