mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: tighten target-size compression tolerance from 5% to 1%
The binary search exited early at 5% tolerance, producing output like 48.3KB for a 50KB target. Reducing to 1% with 12 iterations makes the output much closer to the requested target.
This commit is contained in:
@@ -58,8 +58,8 @@ async function findBestQuality(
|
||||
let low = 1;
|
||||
let high = 100;
|
||||
let bestQuality: number | null = null;
|
||||
const maxIterations = 8;
|
||||
const tolerance = 0.05;
|
||||
const maxIterations = 12;
|
||||
const tolerance = 0.01;
|
||||
|
||||
for (let i = 0; i < maxIterations && low <= high; i++) {
|
||||
const mid = Math.min(100, Math.max(1, Math.round((low + high) / 2)));
|
||||
|
||||
Reference in New Issue
Block a user