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
Next/future/image blur placeholder renders with visual artifacts #40419
Comments
Same happens on Safari. The problem appears if the aspect ratio of the placeholder is different from the ratio of the displayed image. |
Thanks for reporting! This issue is likely caused by the aspect ratio of the of the provided
I believe we can fix the artifacts with |
This PR fixes two bugs: - Fixes #40419 - Fixes #41393 The first is when the aspect ratio of the `width` and `height` does not match the aspect ratio of the `blurDataURL` provided. This can result in artifacts around the edges. The solution is to add `preserveAspectRatio="none"`. The second is when there is no `width` or `height` provided (which is normal when using `fill`) so the viewBox was undefined. This can also cause artifacts around the edges. The solution is to change the blur technique from gaussian to css filter, similar to `next/legacy/image`. Note: css blur might be [slower in firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=925025) which is why we'll only use it for this corner case.
This PR fixes two bugs: - Fixes vercel#40419 - Fixes vercel#41393 The first is when the aspect ratio of the `width` and `height` does not match the aspect ratio of the `blurDataURL` provided. This can result in artifacts around the edges. The solution is to add `preserveAspectRatio="none"`. The second is when there is no `width` or `height` provided (which is normal when using `fill`) so the viewBox was undefined. This can also cause artifacts around the edges. The solution is to change the blur technique from gaussian to css filter, similar to `next/legacy/image`. Note: css blur might be [slower in firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=925025) which is why we'll only use it for this corner case.
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
Chrome 105.0.5195.102
How are you deploying your application? (if relevant)
Vercel and Linode (occurs in all environments)
Describe the Bug
When using the Image component from
next/future/image
with a blur placeholder and base64 blurDataURL, the placeholder renders in Chrome 105.0.5195.102 with visual artifacts, likely because the placeholder is being requested with a different request URL (i.e. we specified adata:image/jpeg;
but the placeholder in the browser is being requested asdata:image/svg+xml
with an svg filter appliedI deployed an example to https://nextjs-next-image-issue.vercel.app/ and https://github.com/iominh/nextjs-next-image-issue.
It might be hard to see the blur placeholder but if you use the chrome devtools to apply heavy throttling (e.g. with 3g) and/or just look at the devtools you'll see the placeholder is loaded incorrectly with visual artifacts and the wrong requestURL
Here's an example based on Next 12.3.0 and React 18.2.0:
In the chrome dev tools you can see the placeholder renders like the following:
Expected Behavior
I would've expected the placeholder to render without artifacts and with the correct type
Before next/future/image, the next/image component would return a placeholder like the following:
Instead it now returns the following:
Link to reproduction
https://nextjs-next-image-issue.vercel.app/, https://github.com/iominh/nextjs-next-image-issue
To Reproduce
Go to https://nextjs-next-image-issue.vercel.app/ to see the placeholder load or create an image like shown in the description above
The text was updated successfully, but these errors were encountered: