linebender / linebender/resvg

Low image quality when downscaling

Abierto
#653 11 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug
Lenguaje dominante
Rust
Estrellas
4.1k
Forks
348
Merge medio
1 d 14 h
PR fusionados (30 d)
3

Descripción

The use case is a PNG image which is base64-encoded and embedded in the SVG in an `` tag. In the attached example, the original image is 160x160, and scaled down to 49x49 in the SVG markup.
![emoji-49px-base64](https://github.com/RazrFalcon/resvg/assets/15127801/98fb643d-ce2e-4844-9a8a-1ff05d00cc1d)

The rendered image (resvg-rendered-49px.png) quality is degraded, especially on the curves.
![resvg-rendered-49px](https://github.com/RazrFalcon/resvg/assets/15127801/379e81b0-47cf-4f3c-be88-b67ae7ae469d)

When defining the dimensions as 160x160 in the SVG markup, the rendered image (resvg-rendered-160px.png) quality is great. And when including that image on an HTML page and re-scaling in the HTML markup, ``, the image quality remains crisp.
![resvg-rendered-160px](https://github.com/RazrFalcon/resvg/assets/15127801/c7d37682-fa93-4581-afcd-5f4329e20ba5)

We also tried setting the `image-rendering` attribute for `OptimizeQuality`, but the improvement was negligible.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/image-rendering

Is is correct that Bicubic interpolation is being used? Do you have any guidance for improving image quality, and/or are there plans for other interpolation options?

Processing this same image with various interpolation filters in `ImageSharp` (e.g. Lanczos, MitchellNetravali, etc.) does produce a high quality result.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza reproduciendo el caso adjunto: un PNG base64 de 160x160 incrustado en una imagen SVG y renderizado a 49x49; después, compáralo con el renderizado de 160x160 escalado en HTML. Comprueba el efecto de image-rendering="OptimizeQuality" y el comportamiento de la interpolación. Se considera terminado cuando la imagen SVG reducida tenga una calidad de curvas visiblemente mejorada o se documenten las limitaciones de interpolación admitidas.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rust
Área
computer-graphics
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.