mirror of
https://github.com/upscayl/upscayl.git
synced 2024-11-30 18:24:27 +01:00
Fix scale slider
This commit is contained in:
parent
d74188f748
commit
269d5d9603
@ -565,28 +565,35 @@ ipcMain.on(commands.UPSCAYL, async (event, payload) => {
|
|||||||
failed = true;
|
failed = true;
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
const onClose = () => {
|
const onClose = async () => {
|
||||||
if (!failed && !stopped) {
|
if (!failed && !stopped) {
|
||||||
logit("💯 Done upscaling");
|
logit("💯 Done upscaling");
|
||||||
logit("♻ Scaling and converting now...");
|
logit("♻ Scaling and converting now...");
|
||||||
Jimp.read(
|
const originalImage = await Jimp.read(inputDir + slash + fullfileName);
|
||||||
isAlpha ? outFile + ".png" : outFile,
|
try {
|
||||||
(err: any, image: any) => {
|
const newImage = await Jimp.read(
|
||||||
if (err) {
|
isAlpha ? outFile + ".png" : outFile
|
||||||
logit("❌ Error converting to PNG: ", err);
|
);
|
||||||
onError(err);
|
try {
|
||||||
return;
|
newImage
|
||||||
}
|
.scaleToFit(
|
||||||
image
|
originalImage.getWidth() * parseInt(payload.scale),
|
||||||
.scale(parseInt(payload.scale as string))
|
originalImage.getHeight() * parseInt(payload.scale)
|
||||||
|
)
|
||||||
.write(isAlpha ? outFile + ".png" : outFile);
|
.write(isAlpha ? outFile + ".png" : outFile);
|
||||||
mainWindow.setProgressBar(-1);
|
mainWindow.setProgressBar(-1);
|
||||||
mainWindow.webContents.send(
|
mainWindow.webContents.send(
|
||||||
commands.UPSCAYL_DONE,
|
commands.UPSCAYL_DONE,
|
||||||
isAlpha ? outFile + ".png" : outFile
|
isAlpha ? outFile + ".png" : outFile
|
||||||
);
|
);
|
||||||
|
} catch (error) {
|
||||||
|
logit("❌ Error converting to PNG: ", error);
|
||||||
|
onError(error);
|
||||||
}
|
}
|
||||||
);
|
} catch (error) {
|
||||||
|
logit("❌ Error reading original image metadata", error);
|
||||||
|
onError(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
export function DonateButton({}) {
|
export function DonateButton({}) {
|
||||||
return (
|
return (
|
||||||
<div className="mt-auto flex flex-col items-center justify-center gap-2 text-sm font-medium">
|
<div className="flex flex-col gap-2 text-sm font-medium">
|
||||||
<p>If you like what we do :)</p>
|
<p>If you like what we do :)</p>
|
||||||
<a href="https://buymeacoffee.com/fossisthefuture" target="_blank">
|
<a
|
||||||
<button className="btn-primary btn">Donate</button>
|
href="https://buymeacoffee.com/fossisthefuture"
|
||||||
|
target="_blank"
|
||||||
|
className="btn-primary btn">
|
||||||
|
Donate
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -20,7 +20,7 @@ export function ImageScaleSelect({ scale, setScale }: ImageScaleSelectProps) {
|
|||||||
</div>
|
</div>
|
||||||
<input
|
<input
|
||||||
type="range"
|
type="range"
|
||||||
min="2"
|
min="1"
|
||||||
max="4"
|
max="4"
|
||||||
value={scale}
|
value={scale}
|
||||||
onChange={(e: any) => {
|
onChange={(e: any) => {
|
||||||
@ -30,22 +30,11 @@ export function ImageScaleSelect({ scale, setScale }: ImageScaleSelectProps) {
|
|||||||
className="range range-primary mt-2"
|
className="range range-primary mt-2"
|
||||||
/>
|
/>
|
||||||
<div className="flex w-full justify-between px-2 text-xs font-semibold text-base-content">
|
<div className="flex w-full justify-between px-2 text-xs font-semibold text-base-content">
|
||||||
|
<span>1x</span>
|
||||||
<span>2x</span>
|
<span>2x</span>
|
||||||
<span>3x</span>
|
<span>3x</span>
|
||||||
<span>4x</span>
|
<span>4x</span>
|
||||||
</div>
|
</div>
|
||||||
{scale !== "4" && (
|
|
||||||
<p className="mt-1 text-center text-xs text-base-content/70">
|
|
||||||
This may generate unexpected output!
|
|
||||||
<br />
|
|
||||||
<a
|
|
||||||
className="link"
|
|
||||||
href="https://github.com/upscayl/upscayl/wiki/Guide#scale-option"
|
|
||||||
target="_blank">
|
|
||||||
See Wiki
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -128,12 +128,16 @@ function SettingsTab({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="animate-step-in animate flex h-screen flex-col gap-7 overflow-y-auto p-5 overflow-x-hidden">
|
<div className="animate-step-in animate flex h-screen flex-col gap-7 overflow-y-auto p-5 overflow-x-hidden">
|
||||||
<a
|
<div className="flex flex-col gap-2 text-sm font-medium">
|
||||||
className="btn-primary btn"
|
<p>Having issues?</p>
|
||||||
href="https://github.com/upscayl/upscayl/wiki/"
|
<a
|
||||||
target="_blank">
|
className="btn-primary btn"
|
||||||
Read WIKI
|
href="https://github.com/upscayl/upscayl/wiki/"
|
||||||
</a>
|
target="_blank">
|
||||||
|
Read Wiki Guide
|
||||||
|
</a>
|
||||||
|
<DonateButton />
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* THEME SELECTOR */}
|
{/* THEME SELECTOR */}
|
||||||
<ThemeSelect />
|
<ThemeSelect />
|
||||||
@ -167,9 +171,6 @@ function SettingsTab({
|
|||||||
isCopied={isCopied}
|
isCopied={isCopied}
|
||||||
logData={logData}
|
logData={logData}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* DONATE BUTTON */}
|
|
||||||
<DonateButton />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user