Currently gatsby-plugin-sharp returns the aspectRatio of images[0], which is the smallest image and likely has the most inaccurate aspectRatio. The fix changes images[0] to images[images.length - 1] to use the largest image.
Documentation
No documentation is needed since it's an internal fix.
Tests
I've added a unit test to process an image of 1000x746. The accurate aspectRatio should be 0.746 while the smallest image has a ratio of 0.7466....
Description
Currently
gatsby-plugin-sharp
returns theaspectRatio
ofimages[0]
, which is the smallest image and likely has the most inaccurateaspectRatio
. The fix changesimages[0]
toimages[images.length - 1]
to use the largest image.Documentation
No documentation is needed since it's an internal fix.
Tests
I've added a unit test to process an image of 1000x746. The accurate
aspectRatio
should be0.746
while the smallest image has a ratio of0.7466...
.Related Issues
Fixes #24212