linebender / linebender/resvg

Low image quality when downscaling

オープン
#653 コメント 11 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug
主要言語
Rust
スター
4.1k
フォーク
348
平均マージ
1日 14時間
マージ済み PR(30日)
3

説明

The use case is a PNG image which is base64-encoded and embedded in the SVG in an <image> tag. In the attached example, the original image is 160x160, and scaled down to 49x49 in the SVG markup.
emoji-49px-base64

The rendered image (resvg-rendered-49px.png) quality is degraded, especially on the curves.
resvg-rendered-49px

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, <img src="resvg-rendered-160px.png" width="49" height="49">, the image quality remains crisp.
resvg-rendered-160px

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、添付されたケースを再現します。160x160 の base64 PNG を SVG 画像に埋め込み、49x49 でレンダリングしたものを作成し、次に HTML でスケーリングした 160x160 のレンダリングと比較します。image-rendering="OptimizeQuality" の効果と補間の挙動を確認します。縮小された SVG 画像の曲線品質が目に見えて改善されるか、サポートされている補間の制限が文書化されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
computer-graphics
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。