mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat: overhaul upscale with bug fixes and advanced features
- Fix multi-image: process selected file, not always first - Fix progress bar: asymptotic fill prevents visual stalling - Fix slider: write results to captured index, not current selection - Add model selection (Auto/AI/Fast), face enhancement, denoise - Add output format (PNG/JPEG/WebP) with quality control - Add Upscale All for sequential batch processing with queue - More granular Python progress stages for smoother UX
This commit is contained in:
@@ -4,6 +4,11 @@ import { type ProgressCallback, runPythonWithProgress } from "./bridge.js";
|
||||
|
||||
export interface UpscaleOptions {
|
||||
scale?: number;
|
||||
model?: string;
|
||||
faceEnhance?: boolean;
|
||||
denoise?: number;
|
||||
format?: string;
|
||||
quality?: number;
|
||||
}
|
||||
|
||||
export interface UpscaleResult {
|
||||
@@ -11,6 +16,7 @@ export interface UpscaleResult {
|
||||
width: number;
|
||||
height: number;
|
||||
method: string;
|
||||
format: string;
|
||||
}
|
||||
|
||||
export async function upscale(
|
||||
@@ -34,11 +40,14 @@ export async function upscale(
|
||||
throw new Error(result.error || "Upscaling failed");
|
||||
}
|
||||
|
||||
const buffer = await readFile(outputPath);
|
||||
// Python may write to a different path when the output format changes
|
||||
const actualOutputPath = result.output_path || outputPath;
|
||||
const buffer = await readFile(actualOutputPath);
|
||||
return {
|
||||
buffer,
|
||||
width: result.width,
|
||||
height: result.height,
|
||||
method: result.method ?? "unknown",
|
||||
format: result.format ?? "png",
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user