Responsive Images

All about Responsive Images

Responsive Featured Image

Recently, I have been getting a lot of

  1. Requests for an article on Responsive Images,
  2. and error-sheets of my responsive projects mentioning that some full screen image is cropped in x resolution(s).

So, this motivated me to write an article on Responsive Images. Part1 of this series is more aimed at Project Managers and Designers. But nevertheless, Front End developers can also follow along; your valuable time in explaining the team how Responsive Images work will be saved.

Embrace the Environment

We are living in a world where there is a strong proliferation of internet based devices in Market. From Tablets, to phones to wearable glasses, it won’t be too long that our refrigerators and bath tubs will have a tablet with a browser in them. The main issue is not the screen resolution but the Aspect Ratio.

![Aspect Ratios of Laptops,Phones and tablets is not same.](/spider/content/images/wp-content/uploads/2013/09/Responsive-Image–aspect-ratios.jpg)
(Being Applefanboy, I have only taken into consideration Aspect ratios of iMac, iPad and iPhone; there are various devices with different aspect ratios in market)
There are only 2 ways we can address these issues:
  1. Image Cropping Method
  2. Maximum Width Scale Method
  3. Bonus

Image Cropping Method

This method is very popular for full screen backgrounds. The images are cropped and approximately shown what region is required.

Responsive Image Full Screen on Computer

![Responsive Image getting cropped in Full screen](/spider/content/images/wp-content/uploads/2013/09/Responsive-Image-fullscreen-iMac-cropped.jpg)
(Notice the cropped part in blue shade)
![Full Screen Background Image in iPhone](/spider/content/images/wp-content/uploads/2013/09/Responsive-Image-fullscreen-iPhone.jpg) ![Full Screen Background Image in iPad](/spider/content/images/wp-content/uploads/2013/09/Responsive-Image-fullscreen-iPad.jpg)

Maximum Width/Height Scale Method

In the next method, we will set a maximum width (or height) for the image. The image will proportionately scale down as per the image aspect ratio. Image scaling will be as per the image dimension(height and width) and not as per browser size. Plus Point: Your images won’t be cropped!

/* for horizontally rectangular images */<br></br>
img{
    max-width: 100%
}
/* for vertically rectangular images */<br></br>
img{
    max-height: 100%<br></br>
}

Mobile Web: Tablets Max Width 100%
Mobile Web: Phone Max Width 100%

Now, if we want to use this method for our background image, the image will have either a white-space or scroll as follows:

Responsive-Image-scroll-iMac

Responsive-Image-whitespace-iMac

Thus, we will not be able to use Maximum Width/Height Scale Method if we want to use a full screen image (100% width and 100% height) without a scroll or a whitespace. Image Cropping Method is the only solution when we need a background image which spans 100% width and height of browser without scroll.

one last Thing…..

Squeeze the bloody Image (bonus)

This isn’t a method per say, But for all those front end developers who have some sort of grudge for the designer, this method will definitely serve your revengeful needs. You will use this method and bet you, the designer will definitely get exasperated.

Squeezed Responsive Image

img.irritate{
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    right: 0;
    z-index: 0
}

So, That’s All for today!
Will be bringing you the next parts very soon!
Till then,
Keep Rocking!