samizdatco / skia-canvas

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

[Feature Request] Jpeg DownSample options #146

Open antoox-yk opened 1 year ago

antoox-yk commented 1 year ago

Hi team,

I noticed that the JPEG downsampling option is currently set to Downsample::BothDirections => SkJpegEncoder_Downsample::k420 by default, as shown here.

In certain use cases, this default setting can cause exported JPEG images to appear "blurry." For high-quality exports, I currently work around this by exporting images as PNG first, then converting them to JPEG with 4:4:4 subsampling using a separate library. However, this is a multi-step process that adds complexity and extra resource usage.

Feature Proposal:

It would be highly beneficial to allow custom downsampling settings directly within the toBuffer function. This enhancement would provide users with more control over the output quality, enabling the selection of different subsampling options (such as 4:4:4) to avoid potential quality loss.

Thank you for considering this feature!