title: Set image max size
body: <p>I need to set maximum height and width of a image in <code>&lt;img&gt;</code> tag. For example say max size is 400x400 px so if the image size is smaller than this then it will show the image as it is and if size is bigger then this then it should be compressed to this size. How can I do this in html or javascript?</p>