Inconsistencies in SVG Image Sizing and Blurriness When Loaded from URLs Using Coil in Jetpack Compose #2048
Labels
help wanted
Issues that are up for grabs + are good candidates for community PRs
Description:
In a Jetpack Compose project utilizing Coil (version 2.4.0), SVG images loaded from URLs fail to retain their intrinsic dimensions, scaling up to the maximum size set with .sizeIn(maxWidth = 16.dp, maxHeight = 16.dp). This issue does not occur with SVGs loaded from drawable resources, which correctly maintain their intrinsic sizes. To ensure accurate sizing, Size.ORIGINAL is utilized in the image request, which leads to another problem: the images become blurry due to scaling from pixel-based sizes to dp in the UI.
Steps to Reproduce:
Expected Behavior:
Additional Context:
A custom SvgDecoder was introduced to tackle the blurriness, altering the getDstSize function to translate SVG dimensions into dp for UI consistency. While this resolved the blurriness, modifying library components is risky, potentially leading to future compatibility issues. Ideally, default support for this scenario in the SVGDecoder would avoid the need for custom implementations.
Version:
Coil version: 2.4.0
The problem has been noted on various API levels and Android devices.
Related Bug and Discussions:
Note:
In my view, such intrinsic size handling should be natively supported by Coil's SVGDecoder to avoid the need for custom implementations that may introduce future maintenance challenges.
The text was updated successfully, but these errors were encountered: