betsol / baseline-element

JavaScript library to fix responsive images in vertical rhythm environments
24 stars 5 forks source link

Suboptimal cropping doesn't respect the aspect ratio of images #3

Closed alexgreen closed 5 years ago

alexgreen commented 5 years ago

This is a fantastic script, but it would be much better if it did a better job at respecting the aspect ratio of images. On the demo page the image file has an aspect of 1.5:1, yet the script will often crop it to 1.3:1 or narrower, even though the image doesn't actually require that much cropping to conform to the baseline grid. I.e. the script selects a somewhat arbitrary target baseline.

If you have a 24px baseline grid and a 1.5:1 image then you should never have to crop the width by more than 18px, yet the script will sometime crop by more than 72px.

alexgreen commented 5 years ago

Seems like this issue might actually be specific to the demo page. When I use the script on my own page it works fine.