Document potentially unexpected `autoScale` behavior

This commit is contained in:
Daniel Gasienica 2018-02-13 08:29:20 -05:00
parent 8b4c69b200
commit 8b6494ae6c
1 changed files with 3 additions and 0 deletions

View File

@ -108,6 +108,9 @@
canvas.toDataURL('image/jpeg', quality)
);
quality = quality * maxSize / blob.size;
// NOTE: During testing with a large image, we observed the
// `quality` value being > 1. Should we clamp it to [0.5, 1.0]?
// See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob#Syntax
if (quality < 0.5) {
quality = 0.5;
}