-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Gatsby image sharp traced SVG does not respect forced aspect ratio #9204
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
Comments
Doing some additional testing, this seems to be broken in a few ways. The The only reasonable way that I can see this being fixed would be to first do the cropping and resizing to correct size in the job queue, and then trace the exact generated image without any resize or crop - which constitutes of somewhat of a rewrite of the current code. |
@nakedible can you provide a reproduction repo for this? That would make it much easier to diagnose this issue. As you are not able to provide the result of |
I can confirm that traced SVGs do not match the cropped images. :( |
Looked into this for a couple minutes, and want to clarify that this only is happening for |
No worries, it's nice to get actual bugs found and fixed. I added a comment about |
Old issues will be closed after 30 days of inactivity. This issue has been quiet for 20 days and is being marked as stale. Reply here or add the label "not stale" to keep this issue open! |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m Thanks again for being part of the Gatsby community! |
… forced aspect ratio (#9337) Ref. #9204, not sure if this is the right way to go… - split the [traced-svg](https://using-gatsby-image.gatsbyjs.org/traced-svg/) gallery into two—cropped and uncropped—to demonstrate the fix
Description
When using gatsby-image and gatsby-plugin-sharp to produce traced SVG images for image loading, and specifying both
maxWidth
andmaxHeight
for the resulting image, the traced SVG image is from the full (uncropped) source image, where as the actual generated image is cropped to aspect ratio with the crop location defined bycropFocus
. The end result is very jarring where the traces do not match at all with the actual image when loaded.Instead the traced SVG should match the cropped actual resulting image, meaning that the image should be cropped to correct aspect ratio first, and then traced.
Steps to reproduce
Following GraphQL query:
And usage:
Expected result
Traced SVG should match the image that is to be loaded.
Actual result
Traced SVG is from uncropped image, meaning all lines are at different places.
Environment
Cannot get gatsby info because of #8502.
The text was updated successfully, but these errors were encountered: