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

Support more values for imageRendering #828

Closed
LaurenzV opened this issue Oct 8, 2024 · 1 comment · Fixed by #833
Closed

Support more values for imageRendering #828

LaurenzV opened this issue Oct 8, 2024 · 1 comment · Fixed by #833
Labels

Comments

@LaurenzV
Copy link
Contributor

LaurenzV commented Oct 8, 2024

As a standard SVG attribute, only optimizeSpeed and optimizeQuality are supported (see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/image-rendering), however, as mentioned in the note there, it can also be used as a CSS property with the following possible values:

smooth

The image should be scaled with an algorithm that maximizes the appearance of the image. In particular, scaling algorithms that "smooth" colors are acceptable, such as bilinear interpolation. This is intended for images such as photos.

high-quality

Identical to smooth, but with a preference for higher-quality scaling. If system resources are constrained, images with high-quality should be prioritized over those with any other value, when considering which images to degrade the quality of and to what degree.

crisp-edges

The image is scaled with an algorithm such as "nearest neighbor" that preserves contrast and edges in the image. Generally intended for images such as pixel art or line drawings, no blurring or color smoothing occurs.

pixelated

The image is scaled with the "nearest neighbor" or similar algorithm to the nearest integer multiple of the original image size, then uses smooth interpolation to bring the image to the final desired size. This is intended to preserve a "pixelated" look without introducing scaling artifacts when the upscaled resolution isn't an integer multiple of the original.

Here is an example SVG that uses pixelated:
test

@RazrFalcon
Copy link
Collaborator

Yes, SVG is endless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants