It is possible to use
JavaScript
Web Developer Reading List: JavaScript
and several image files to achieve this, at the cost of swapping multiple image files back and forth over a potentially weak and thin wireless connection. The
<picture>
Responsive Images For Designers: The HTML5 picture element
element achieves the same result, at the expense of bandwidth.
In an ideal world we would have an image format that integrated “dynamic crop marks”, allowing a single source image to adapt to different requirements while preserving its central focus. While we don’t have such a feature yet, we do have SVG’s
viewBox attribute
Understanding the SVG viewBox
, which comes awfully close.
While it is best known as a vector image format, SVG has supported bitmaps from its inception: