Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby-plugin-sharp): read aspectRatio from the largest image possible #39008

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gera2ld
Copy link

@gera2ld gera2ld commented Jun 6, 2024

Description

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....

Related Issues

Fixes #24212

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect aspect ratios when using gatsby-remark-image
1 participant