This commit is contained in:
EthanHealy01 2025-09-29 20:30:51 +01:00
parent bbb059b739
commit 1ccc1ac11a
2 changed files with 3 additions and 2 deletions

View File

@ -31,7 +31,7 @@ export default function AdjustContrastPreview({ file, parameters }: Props) {
}, [file, requestThumbnail]);
useEffect(() => {
let revoked: string | null = null;
const revoked: string | null = null;
const render = async () => {
if (!thumb || !canvasRef.current) return;
const img = new Image();

View File

@ -38,7 +38,8 @@ export function applyAdjustmentsToCanvas(src: HTMLCanvasElement, params: AdjustC
// Saturation via HSL
const rn = r / 255, gn = g / 255, bn = b / 255;
const max = Math.max(rn, gn, bn); const min = Math.min(rn, gn, bn);
let h = 0, s = 0, l = (max + min) / 2;
let h = 0, s = 0;
const l = (max + min) / 2;
if (max !== min) {
const d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);