fix(upscale): auto-orient images before upscaling and improve UI

Fix rotated output by calling autoOrient() before passing images to
the Python upscaler, correcting EXIF orientation metadata. Replace
2x/4x buttons with 2x-8x slider plus quick-select buttons (2x, 3x,
4x, 6x, 8x). Remove technical jargon about Real-ESRGAN/Lanczos from
the UI and progress bar.
This commit is contained in:
Siddharth Kumar Sah
2026-03-26 16:01:40 +08:00
parent f357b18ced
commit 8ee4d7b2fb
2 changed files with 21 additions and 10 deletions
+4
View File
@@ -3,6 +3,7 @@ import { writeFile } from "node:fs/promises";
import { basename, join } from "node:path";
import { upscale } from "@stirling-image/ai";
import type { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
import { autoOrient } from "../../lib/auto-orient.js";
import { validateImageBuffer } from "../../lib/file-validation.js";
import { createWorkspace } from "../../lib/workspace.js";
import { updateSingleFileProgress } from "../progress.js";
@@ -54,6 +55,9 @@ export function registerUpscale(app: FastifyInstance) {
const settings = settingsRaw ? JSON.parse(settingsRaw) : {};
const scale = Number(settings.scale) || 2;
// Auto-orient to fix EXIF rotation before upscaling
fileBuffer = await autoOrient(fileBuffer);
const jobId = randomUUID();
const workspacePath = await createWorkspace(jobId);