fengyuanchen / cropperjs

JavaScript image cropper.
https://fengyuanchen.github.io/cropperjs/
MIT License
13.15k stars 2.42k forks source link

[V2] Get higher image quality #1145

Closed stsrki closed 8 months ago

stsrki commented 8 months ago

Hello, is there a way to get the image with a higher quality by using $toCanvas? In the cropper 1.x, there seemed to be an imageSmoothingQuality, but I don't see it for v2.

fengyuanchen commented 8 months ago

For v2.x, use the beforeDraw option please:

cropperSelection.$toCanvas({
  beforeDraw: (context, canvas) => {
    context.imageSmoothingQuality = 'high';
  },
});