Stretching images while retaining their aspect ratio..?

Hello,
I'm looking for a method that will allow me to resize an image (div background or regular img) to fit as tall and wide as the container allows, while retaining the image's native aspect ratio.
The method I'm currently using is :
#bg {
    height:100%;
    width:100%;
    position:fixed;
    left:0;
    right:0;
    top:0;
    bottom:0;
    padding:0;
    overflow:hidden;
    z-index:-1000;
#bg img {
    height:100%;
<div id="bg"><img src="/images/image0.jpg" /></div>
However, this method only seems to work when the body is the container, and will only keep one of the two axis within view. I can specify either height:100% or width:100%, but not both because that will skew the images natural aspect ratio.
What I'm trying to accomplish is to block off 100 pixels at the bottom for navigation, 300 pixels on the right of the viewport for a text column, and leave the rest to be filled by an image that would stretch as much as the space allows (again, while retaining its aspect ratio).
Your suggestions are welcome!

Hello
First of all, you should never use dreamweaver option to modifie an image. Always use the appropriate programe to resize your image ( Photoshop or illustrator). Even if the web standart are 72 dpi you might never know what is the format of your image, and by stretching too much or downscaling it's size too much you will .. well.. have a low result.
Next : why do you want to keep a zone for navigation ?. Background by default cover everthing, and if you put your navigation on top of it, it will cover the background and make it invisible at that spot because your navigation will be on top of it.
Anyway What you want to do is first define exactly the maximum size of your Bg minus the zone you want to keep blank. Then put the bg and use option like Margin-right, margin-top to force the image to be where you want it to be.
Margin-bottom: 100px for exemple.
You can achieve that in your CSS setting i believe.
Hope this help.

Similar Messages

  • How can one convert a picture to 1080 pixels in height at 72 dpi and retain the aspect ratio?

    How can one convert a picture to 1080 pixels in height at 72 dpi and retain the aspect ratio?

    The ppi has nothing to do with this. It will stay at whatever it is.
    Go to image>resize>resize image, turn ON Resample image and enter 1080 for the height, making sure to leave constrain proportions turned on. Don't mess with the ppi setting.
    If the image is set to another ppi setting, then after you're done with the above, go back into that window, turn OFF resample image, and set the ppi to 72. PPI only affects the inc/cm measurement.

  • IDVD stretches slideshow because of higher aspect ratio

    Hi,
    i created an slide show with iDVD 6 and aspect ratio 16:9
    if i burn the slide show and play it on my iMac, everything is OK, but when i play it on my tv, all images are stretched horizontally. this because the aspect ratio of the tv is 16:10 (i think)
    is there a way to preserve the aspect ratio so my images wont stretch up?
    thanks,
    Dupol

    sounds like an adjustment you may need to address on the TV or remote prior to playing the dvd.

  • How can I properly export an image with corrected pixel aspect ratio?

    Hi, I have a bunch of .png screenshots from old MS-DOS era software that I wish to convert to a 0,8 pixel aspect ratio to simulate the stretch from old CRT monitors.
    I can easily preview it by enabling the pixel aspect ratio correction under the "View" menu, and it looks great. But if I try to "save as" the file as a .png or .gif, it looks blurry and horrible:
    Any hints on how to do this?

    Ok, thanks letting me know. Only last thought is a screen cap of image 2 (that I believe you want) saved to png.
    There's a program called Greenshot that would use the Print screen key and allow you to marquee select and save the shot as a png file. Greenshot - a free and open source screenshot tool for productivity
    That's for Windows, Cmd-Shift-4 on a Mac does the same thing.
    I know it is a pain if you have a hundred of these, but I suppose if you are not in a big hurry you can get it all fixed up.
    Gene

  • Resizing Image and Not Keep Aspect Ratio

    Is there a free program to resize images and not keep the original aspect ratio?
    I need to resize loads of images to 100x100 pixels and have tried Image well and IResize yet they do not seem to have an option to not keep the original aspect ratio.
    Thank you
    20" Intel 2GHz Core Duo imac, 2GB Ram, 250 GB HD    

    Hi, Downsize does not seem all that great according to reviews. Why not see if you can buy PS E' 3 mac -- maybe ebay/amazon (if I remember I only paid about $70 for PS E3) As PS E4 just came out I'm sure someone has PS E3 for sale. You will then have no problems completing your image resizing.
    2 other questions for you..are you using the Mac side of your intel or Windows?
    if your using the Windows side I can let you have PS 6 (PC) ..freegratus.

  • How do I crop an image to WS TV aspect ratio 1.78:1?

    I want to make a slide show of various images, They were made with 35 mm cameras, digital cameras or other means. I want to crop the images to the aspect ratio of modern TVs (16:9 aka 1.78:1). I have PSE 5 and 8. Is thre an easy way I can do this? Thanks.

    Thanks. It works great. I wasn't familiar with that tool.

  • How to export Keynote presentation as images that retain their order

    When I build a Keynote presentation that I then export as images to show in photo album Keynote exports the slides as sequentially numbered images. When the images are uploaded to the iPad the order becomes random. Any one know a way to force the iPad to display the images in the desired order?

    weblizard,
    You can choose File > Print and then choose from the Print output options, including Slides, Slides with Notes, Outline, and Handout. You can also modify the Print outputs from the Options column on the right.
    Then on the bottom left of the Print dialog box, you will see a PDF button. Click on that button for options, including Save to PDF. This will create a nice PDF the selectable text and can include the slide for recognition and recall, as well as copy and paste into other applications.

  • Setting Aspect Ratio when cropping to A3

    Hey folks being new to Lightroom 5.6 I'm probably doing something stupid and I am sure there is an easy solution; I just don't know what it is..
    I have 23 RAW images in my LR Catalogue that I wish to crop, but I also know that I will be saving them as A3 JPGS at 300ppi.  So the first thing I did was go into the Print module and select my Canon Pixma Pro printer so that I can then select a paper size of A3.  In the print module, each image then displays A3 on the left hand side of the main preview window.  So good job, that bit is successful.
    So now I need to crop the images.  I had previously tried cropping them to A4 and therefore had typed 8.27x11.69 into the Custom Aspect Ratio setting (yes I know we're talking inches here.... LOL).  Well I then reset all the images so that their Aspect Ratio is set to "As Shot" and when I select done, the little crop box in the previews along the bottom of the screen disappears....  Still with me?  Oh I hope so
    So now the images are back to their original size as if they were straight off the camera, I selected all 23 images and pressed 'R' to enter the crop function.  Under the Aspect Ratio, I selected "Enter Custom" and tried entering both 297x420 (mm) and also 11.7x16.5 (inches).  On entering each of these ratios, whenever I select <OK>, the Ratio always reverts back to 8.27x11.69, as in A4, which was a custom ratio in the first place!!!!
    Any help on how I can set the Ratio correctly for A3 so that i can actually start doing some cropping would be greatly appreciated.
    Many thanks....
    Lewis

    Sean what a wombat!!!!   (Me that is, not you..... LOL)
    Of course, A3 is two sheets of A4,  That would explain why Lightroom kept showing 8.27x11.69.
    Many thanks for answering what is really common sense when one thinks about it.  Sorry to have wasted peoples time, but thanks once again.
    Lewis

  • How do I restore all images in a collection to original imported aspect ratio?

    Typically I select all images in a catalog, resize the first image to 640x480.  I then right click on the first image (all images are still selected) click on Develop Settings, Sync and choose to sync only the aspect ratio.  All images are then cropped to 640x480 like the first image, which I then export to a folder.
    I then need to restore all images to the original aspect ratio for building a slideshow to export to my website.  I've followed the same procedure i.e. selected all images, click on the first image, change aspect to original, right click on first image and sync aspect ratio for all images.
    The problem is that the rest of the images do not return to their original aspect ratio but revert to 4x6 aspect ratio instead of the original size when imported.  I've changed the lock to unlocked and tried both but still no result.  Now I have to select each image individually, open the crop dialog and choose custom to get it back to the imported aspect ratio.
    How do I batch restore all images in a collection to the aspect ratio when imported?

    Rotating an image is adjusting its crop rotation and crop size.  You originally said you wanted things back to import state which presumably was full resolution w/o any adjustments to ratio, size, or rotation.  If you are wanting to do things in the middle of your other processing I'm less sure what to tell you.
    Taking a crop that you have at 3:2 and setting it to 4:3 shrinks in the longer sides, and resetting the ratio to 3:2 shrinks down the shorter top and bottom--this is how it always works, because a crop box is not ever expanded by setting the ratio to something different, and changing the ratio back and forth like that makes the crop-box smaller and smaller. 
    Are you having an issue because you want to fiddle with the crop in the middle of other processing every time, or is this a special case because you've moved on in your processing after asking your question some time ago? 
    If you routinely need to do this, an easier way might be to export the images at the 3:2 crop, then reimport those JPGs, change the crop on those JPGs, only, then re-export them a second time, and be done with them.  This sounds like you're making proofs?
    If you are making proof-sized images at a different ratio?  Why not just export the 3:2 images at a smallish size, perhaps with a watermark and not have to worry about making them 4:3 ratio?
    Another alternative would be to print the images to JPGs instead of a printer, and set the paper size to a 4:3 ratio and turn on the Fill option--which will chop of the long sides automatically as it prints them.

  • Setting the aspect ratio of an image

    Hi
    Is it possible to specify the aspect ratio of an image? I have a bunch of video shots in my library and they all have non-square pixels so would like to "set" their aspect ratio.
    Thanks upfront!

    If you are using an analog camera, you can set the aspect ratio in MAX. This will correct for non-square pixels.
    If you are using a digital camera, I don't think there is a way to fix it during acquisition. You could resample the image to correct the ratios, but that would be a slow, time consuming process.
    One other possibility is that your computer monitor is in a mode which is not a standard 4x3 configuration. For example 640x480 and 800x600 are 4:3 ratios. 1200x1024 is not, which tends to distort your displayed images.
    Bruce
    Bruce Ammons
    Ammons Engineering

  • Images, JFS, CSS - How to display the correct aspect ratio

    Hello,
    This is not really related to Jave ServerFaces, however, since I am using JSF to build my application, I thought I would post it here.
    I am trying to display images by using the following tag
    <h:graphicImage style="height:200;width:140;border-width: 0;"
    value="img/#{group.items[1].picFileName}-s.jpg"
    alt="#{mainMenuController.item.customerFacingName}"/>The above tag is doing what it is supposed to do, that is display an image with height: 200 and width: 140, which is equal to the aspect ratio
    of 1.43 (=200/143).
    However, some of the images that I want to display, do not have
    the aspect ratio of 1.43. As a result of that, their height or width is modified according to the above values. This distorts some of the imsage.
    I was wondering if some one else had faced that problem and solved it. One solution that can work is to edit the images to produce an aspect ratio of 1.43, however, editing the individual images is not feasible.
    One probable solution that comes to mind is via CSS: that is by FLOATing the image in a box of fixed height and width. By doing this, the aspect ratio of the image will not be affected. I do not know if FLOATing an image in a box is possible or not. I do not know how to float an image in a box.
    More over, I am using Tiles to control the layout. Defining an image box within a <DIV> tag might complicate things.
    Any ideas, comment, suggestion will be heplful!
    Rauf

    Put the post in a HTML/CSS forum....

  • Web Image Aspect Ratio

    Is there a way for images to automatically maintain their aspect ratio when they are loaded in Project Siena?
    Right now I've created a single image in the project and then load various images from the web based on user-provided data. Unfortunately, these images have different aspect ratios and sizes. Is there some way for me to have the image resize automatically
    for each of these new images as they load?
    Thanks for your help.

    Right now, the only waynis to use the Image Position properrty of the control.
    More: Image Position : Fit
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This is beneficial to other community members reading the thread.
    -Bruton

  • Finding images cropped to a particular aspect ratio?

    Hi,
    Is it possible to search for images based on their cropping aspect ratio?
    Andrew.

    Inability to find images based on cropped aspect ratio is definitely pretty annoying.  If I want to print a batch of 4x6 photos, I must now select the pictures I want to print and make sure they are indeed 2x3 or 4x6. This is just extra chore that would have otherwise been avoided.
    What makes it really irritating is that LR already has this information.  It can already display image based on cropped dimension, ie: 4752x3168, all it has to do is divide those two numbers and convert to a the smallest whole numbers, and you get the ratio of  3:2.
    Furthermore, LR doesn't even have to do this calculation on every image.  If the image was cropped using a pre-defined aspect ratio in the cropping tool, such as 1x1, 8x10, this information should already be part of the catalog.  If you select an image and open the cropping tool, it shows what aspect ratio the image is cropped to, such as 8x10, 2x3, etc.  I would assume it is easy to allow filtering/search based on the tool used.

  • Aspect Ratio issues getting 16:9 to look right, what is the best workflow?

    Hi all,
    I am having trouble getting my 16:9 footage to look right when I export, especially when playing on DVD. I shot the footage with a Sony HDR-HC1 which apparently shoots in 16:9 anamorphic. Originally when I imported the footage it appeared it the FCP viewer and canvas in 4:3 letterboxed form, the image did not look squeezed or stretched but appeared with black stripes on top and bottom.
    I have tried several experiments with exporting this footage to dvd with the following results:
    Using Compressor with 4:3 setting in export:
    DVD Studio Pro track settings to 16:9 looks extra squashed vertically
    DVDSP track settings to 4:3 image looks in proper aspect ratio but displays with black stripes on all 4 sides.
    Using Compressor with 16:9 settings in export gives the same results.
    In conclusion, if it appears in 4:3 letterbox in FCP viewer and canvas there is no way to get it to export and display in DVD with proper 16:9 aspect ratio.
    I have also done some experimenting with re-capturing some of the footage from the tape.
    For one sequence I recaptured the footage and it displayed in 4:3 without the letterboxed effect (filling the whole screen) but appeared squeezed, I am guessing that this is because of the anamorphic nature in which my camera captures the footage. No pixels were missing. In the FCP viewer and canvas it looked squeezed and did not display in the correct aspect ratio, however when it was exported via Compressor in 4:3 and then in DVDSP Track Settings put to 16:9 Letterboxed, it is displayed perfectly (letterboxed vertically, the image filling the width of the screen without the extra stripes on the sides).
    So I thought that I had my solution here, although that did involve re-digitizing and batch capturing all 18 tapes used in the project, so its not exactly a quick fix.
    This is where it gets a bit confusing. In order to understand where I had originally gone wrong in my workflow I did some more experiments, this time with the settings on the camera (which I use for a deck in batch capturing). I found the function on the camera where you can set the "TV Type" to either 16:9 or 4:3. I switched the TV Type to 4:3 and when batching it went back to the original letterboxed look (in the batch preview screen that you see while capturing), however when put into the viewer and canvas it was too letterboxed and looked squashed vertically. So then I switched back to TV Type 16:9, now it looks 4:3 squeezed in the batch preview screen (no letterboxing, no missing pixels), however when it goes into the viewer and canvas it becomes letterboxed like the original footage that I had described earlier.
    So now even though I have switched the camera back to its original settings it will not display in that 4:3 squeezed look in FCP viewer and canvas.
    So after all that my main questions are, in 16:9 can I view it in the FCP viewer and canvas in its correct (anamorphically converted) aspect ratio and still export it without the black bars on all sides?
    (The FCP canvas seems to only display in 4:3)
    If not, what setting do I need to capture in FCP in the 4:3 squeezed look I have described earlier?
    (This is the only setting that I have found that displays properly when anamorphically stretched via DVDSP)
    I know that this is a long essay so thanks for making it this far. I have spent weeks experimenting trying to find the best solution so please help me if you know how! I will be very appreciative.
    Thanks
    Liam

    Hi there,
    I am not sure if it is necessarily a bug, but its a matter of understanding all of the settings needed. I had the same problems for a while but after a fair bit of trial and error have found some workable settings.
    It probably has more to do with the export settings rather than what viewer options have selected (I don't think that viewer settings affect your export).
    What program are you using to export?
    I am using compressor to export with aspect ration set to automatic 16:9. Then use DVDSP with the track set to 16:9 letterbox, it seems to export to DVD with the correct aspect ratio that way.
    I am having trouble with the image strobing, looks like some kind of interlacing problem, but at least I have got it in the right aspect ratio.
    Its typical video, solve one problem and it just creates another.
    I am yet to find the absolute best workflow.
    In response to Andy above, the original letterboxed footage probably did have something to do with the downconverting settings on the camera, as when I import without downconverting it does not letterbox. In the HDR-HC1 there is an option in the menu called "TV Type" with options of 4:3 or 16:9. I was reviewing my footage on a 4:3 television so I most likely had it set to 4:3 which created the letterboxing in the viewer when I then imported the footage.
    Importing the footage in HDV solves the issue of aspect ratio, but creates a new problem with the image strobing.
    I hope this was some kind of help to you.
    Liam

  • Pixel/aspect ratio precise picture resizing without doing math?

    Does anybody know how to export pictures with precise dimensions and aspect ratio, without having to do math?
    *Use case:* The task at hand...
    Imagine you want to export a picture for your desktop on, let's say an iMac, (fullscreen without borders or stretching) ... the display real estate is 1680x1050.
    The camera produces 3892x2586 pixels, which translates into an aspect ratio of 3:2.
    Problem:
    Aperture allows to export pictures for a certain dimension retaining the original aspect ratio. Exporting with a setting of "Fit within 1680x1050" will produce - however - pictures that are 1576x1050... so the screen of the iMac will not be covered entirely (unless you set it to "fill screen" in the desktop picture system setting that is).
    So to get this problem solved one has to crop the image to the right aspect ratio in the first place. Unfortunately though, Aperture does not allow one to use the actual pixel values in the crop dialogue.
    Thinking about how to get this problem solved, I had no better idea than to find the lowest common denominator of 1680 and 1050 to cut down those numbers to 8 by 5.
    Why doesn't Aperture allow me to put any two numbers into the crop dialogue?! This restriction makes no sense to me.
    Does anyone of you have a better solution for this problem or am I overlooking something?
    Thanks

    Hi Ian, thanks for that swift reply. Great to see that 2.1 brought this new feature as well.

Maybe you are looking for

  • Change the kernel keymap and xkbd keyboard layout?

    I'd like to remap CTRL+(Left,Right,Up,Down) to Begin,End,PgUp,PgDown And i've to say that i almost succeded, but probably there's a better way. For the tty, i made a modified it.map.gz called itCtrlArrows.map.gz, put it into /usr/share/kbd/keymaps/i3

  • Vertical blue line is displaying on the screen.

    In my iphone4 the vertical blue line is displaying on the screen.please provide the solution. the running ios is 6.1.3.

  • How to create a table using a variable or flat file ?

    Hello All, I want to create a table in which column names and data type will be read from a flat file or a variable. How can i do this ? Any suggestations are appricaible..... Regards, Ashish

  • Css styles in rendered html

    I'm trying to find where i can access the settings that determine the embedded style sheet that gets rendered with the html.I'd like to add a print style to the embedded style. Thank you Karl

  • Only BI Administrators can receive cache seed?

    Hi: I want to seed cache to everyone, say 10 users, by iBots. So I firstly purged all caches, and then delivery a report, setting the destination as "Oracle BI Server Cache" and Recipients are the 10 users. However, after done, when looking into the