samizdatco / skia-canvas

A GPU-accelerated 2D graphics environment for Node.js
MIT License
1.67k stars 63 forks source link

jpeg rendering quality #146

Open antoox-yk opened 1 year ago

antoox-yk commented 1 year ago

Hi there,

I stumbled upon a rendering quality problem when exporting the canvas as JPEG: at small dimensions (e.g. 300x250) the exported jpeg seems "blurry".

Here is the difference between (these visuals are just examples & the quality property is set to 1):

  1. a JPEG created with skia-canvas e653672b-3f70-4676-b923-dc82d5bad740

  2. a PNG created with skia-canvas & then transformed with sharp (same result if directly exported as a jpeg with node-canvas). 7f581a8b-c8fc-4839-8276-161e8c43c66a

If you zoom on it, you will obviously notice that the red line is very blurred in the first JPEG. From my point of view, this seems to come from the chroma subsampling, but I haven't found a way to set it in the export options (nor in the skia-rust library).

Do you have any idea how to fix this, or at least how to improve the JPEG quality?