Inaccuracy in README.md: null Method Description in argorithm Should Reflect Fastest but Lowest Quality
Description:
The README.md file contains an inaccurate description of the null method in the argorithm property. It states that the null method provides the "best quality and fastest" resizing. However, based on the source code, the null method appears to be the fastest but with the lowest quality because it does not use any advanced algorithm.
Package Version:
2024.1.0
Problem:
The current description of the null method in the argorithm section of the README.md is misleading. It should indicate that the null method is the fastest but produces the lowest quality output.
Current README.md Snippet:
null: Just resize with drawImage(). The best quality and fastest.
Proposed Fix:
Update the description to accurately reflect the behavior of the null method.
Corrected README.md Snippet:
null: Just resize with drawImage(). The fastest but lowest quality.
Supporting Evidence:
Based on the source code of the scaleCanvasWithAlgorithm function, the null method uses scaled.getContext("2d")?.drawImage(canvas, 0, 0, scaled.width, scaled.height), which is a fast operation but does not employ any advanced algorithm for quality.
Source Code Snippet:
async function scaleCanvasWithAlgorithm(canvas, config) {
const scale = config.outputWidth / canvas.width;
const scaled = new OffscreenCanvas(Math.floor(config.outputWidth), getTargetHeight(canvas.height, scale, config));
switch (config.argorithm) {
case "hermite": {
prepareHermit();
await hermite.resampleAuto(canvas, scaled, config);
break;
}
case "hermite_single": {
const { srcImgData, destImgData } = getImageData(canvas, scaled);
prepareHermit();
hermite.resampleSingle(srcImgData, destImgData, config);
scaled?.getContext("2d")?.putImageData(destImgData, 0, 0);
break;
}
case "bilinear": {
const { srcImgData, destImgData } = getImageData(canvas, scaled);
bilinear(srcImgData, destImgData, scale);
scaled?.getContext("2d")?.putImageData(destImgData, 0, 0);
break;
}
default: {
scaled.getContext("2d")?.drawImage(canvas, 0, 0, scaled.width, scaled.height);
break;
}
}
return scaled;
}
Steps to Reproduce:
- Check the README.md file for the description of the
null method in the argorithm section.
- Compare the description with the source code implementation.
Suggested Labels:
documentation
bug
good first issue
Inaccuracy in README.md:
nullMethod Description inargorithmShould Reflect Fastest but Lowest QualityDescription:
The README.md file contains an inaccurate description of the
nullmethod in theargorithmproperty. It states that thenullmethod provides the "best quality and fastest" resizing. However, based on the source code, thenullmethod appears to be the fastest but with the lowest quality because it does not use any advanced algorithm.Package Version:
2024.1.0Problem:
The current description of the
nullmethod in theargorithmsection of the README.md is misleading. It should indicate that thenullmethod is the fastest but produces the lowest quality output.Current README.md Snippet:
Proposed Fix:
Update the description to accurately reflect the behavior of the
nullmethod.Corrected README.md Snippet:
Supporting Evidence:
Based on the source code of the
scaleCanvasWithAlgorithmfunction, thenullmethod usesscaled.getContext("2d")?.drawImage(canvas, 0, 0, scaled.width, scaled.height), which is a fast operation but does not employ any advanced algorithm for quality.Source Code Snippet:
Steps to Reproduce:
nullmethod in theargorithmsection.Suggested Labels:
documentationbuggood first issue