fengyuanchen/cropperjs

Sometimes after crop white color not white

Offen

#1.072 geöffnet am 17.05.2023

 (7 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (2.431 Forks)batch import
help wantedquestionv1

Repository-Metriken

Stars
 (13.864 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Describe the bug Sometimes after crop white color not white, it depends on the position crop area. It happens on all images with white color(maybe not only white, but on white color it more noticeably) only on chrome browser.

To Reproduce

const cropper = new cropperjs(document.getElementById('source'), {
  aspectRatio: 1,
  ready: function() {
    this.cropper.setCropBoxData({
      left: 72,
      top: 18,
      width: 250,
      height: 250,
    })
    
    crop()
  }
})

function crop() {
  document.getElementById('preview').src = cropper.getCroppedCanvas({
    imageSmoothingEnabled: true,
    imageSmoothingQuality: 'high',
    fillColor: '#fff',
  }).toDataURL()
}

document.getElementById('save').onclick = crop

https://codepen.io/rodigy/pen/abRRmQq

Expected behavior White color not chaged.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version 113

Additional context Tested on firefox, work fine

Contributor Guide