strues / retinajs

JavaScript, SCSS, Sass, Less, and Stylus helpers for rendering high-resolution image variants
http://retinajs.com
MIT License
4.42k stars 611 forks source link

define width and height of image to avoid loading unnecessary images #258

Open studio404pl opened 8 years ago

studio404pl commented 8 years ago

Hi,

i was thinking is there any to define somehow to your script to load 'optionally' images in high resolution?

For example i am loading some image 600px x 400px and in desktop version i need to load retina version of that image. But for example when someone is on mobile version and viewport is around 300px wide, my image has to be around 300px x 200px so technically it's already upscaled to @2x with default image (600x400), delivering in that case image with resolution 1200px x 800px makes it double double.

I am curious if there is any way to check that kind of conditions before loading images? Speed insight is really mad about delivering large images for mobile version.

Really great plugin by the way, i'd really love new version! Thanks!