mirror of
https://github.com/upscayl/upscayl.git
synced 2024-11-23 23:21:05 +01:00
Fix image
This commit is contained in:
parent
53c3ac3aed
commit
8759f29798
@ -5,14 +5,14 @@
|
||||
*/
|
||||
|
||||
import { join, dirname, resolve } from "path";
|
||||
import getPlatform from "./getPlatform";
|
||||
import { getArch, getPlatform } from "./getDeviceSpecs";
|
||||
import isDev from "electron-is-dev";
|
||||
import { app } from "electron";
|
||||
|
||||
const appRootDir = app.getAppPath();
|
||||
|
||||
const binariesPath = isDev
|
||||
? join(appRootDir, "resources", getPlatform()!, "bin")
|
||||
? join(appRootDir, "resources", getPlatform()!, getArch()!, "bin")
|
||||
: join(dirname(appRootDir), "bin");
|
||||
|
||||
const execPath = (execName) =>
|
||||
|
32
electron/getDeviceSpecs.ts
Normal file
32
electron/getDeviceSpecs.ts
Normal file
@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
import { platform, arch } from "os";
|
||||
|
||||
export const getPlatform = () => {
|
||||
switch (platform()) {
|
||||
case "aix":
|
||||
case "freebsd":
|
||||
case "linux":
|
||||
case "openbsd":
|
||||
case "android":
|
||||
return "linux";
|
||||
case "darwin":
|
||||
case "sunos":
|
||||
return "mac";
|
||||
case "win32":
|
||||
return "win";
|
||||
}
|
||||
};
|
||||
|
||||
export const getArch = () => {
|
||||
switch (arch()) {
|
||||
case "x64":
|
||||
return "x64";
|
||||
case "x32":
|
||||
return "x86";
|
||||
case "arm":
|
||||
return "arm";
|
||||
case "arm64":
|
||||
return "arm64";
|
||||
}
|
||||
};
|
@ -1,21 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
import { platform } from "os";
|
||||
|
||||
const getPlatform = () => {
|
||||
switch (platform()) {
|
||||
case "aix":
|
||||
case "freebsd":
|
||||
case "linux":
|
||||
case "openbsd":
|
||||
case "android":
|
||||
return "linux";
|
||||
case "darwin":
|
||||
case "sunos":
|
||||
return "mac";
|
||||
case "win32":
|
||||
return "win";
|
||||
}
|
||||
};
|
||||
|
||||
export default getPlatform;
|
@ -1,6 +1,6 @@
|
||||
// Native
|
||||
import { autoUpdater } from "electron-updater";
|
||||
import getPlatform from "./getPlatform";
|
||||
import { getPlatform } from "./getDeviceSpecs";
|
||||
import { join, parse } from "path";
|
||||
import log from "electron-log";
|
||||
import { format } from "url";
|
||||
@ -61,7 +61,7 @@ let mainWindow: BrowserWindow | null = null;
|
||||
app.on("ready", async () => {
|
||||
await prepareNext("./renderer");
|
||||
|
||||
log.info("🚀 UPSCAYL EXEC PATH: ", execPath(""));
|
||||
log.info("🚀 UPSCAYL EXEC PATH: ", execPath("realesrgan"));
|
||||
log.info("🚀 MODELS PATH: ", modelsPath);
|
||||
|
||||
mainWindow = new BrowserWindow({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ipcRenderer, contextBridge } from "electron";
|
||||
import getPlatform from "./getPlatform";
|
||||
import { getPlatform } from "./getDeviceSpecs";
|
||||
|
||||
// 'ipcRenderer' will be available in index.js with the method 'window.electron'
|
||||
contextBridge.exposeInMainWorld("electron", {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import getPlatform from "../getPlatform";
|
||||
import { getPlatform } from "../getDeviceSpecs";
|
||||
const slash: string = getPlatform() === "win" ? "\\" : "/";
|
||||
|
||||
export const getSingleImageArguments = (
|
||||
|
@ -54,12 +54,11 @@
|
||||
"build": {
|
||||
"productName": "Upscayl",
|
||||
"appId": "org.upscayl.app",
|
||||
"artifactName": "${name}-${version}-${os}-${arch}.${ext}",
|
||||
"artifactName": "${name}-${version}-${os}.${ext}",
|
||||
"asar": true,
|
||||
"afterSign": "scripts/notarize.js",
|
||||
"extraFiles": [
|
||||
{
|
||||
"from": "resources/${os}/${arch}/bin",
|
||||
"from": "resources/${os}/bin",
|
||||
"to": "resources/bin",
|
||||
"filter": [
|
||||
"**/*"
|
||||
|
@ -107,7 +107,6 @@ function LeftPaneImageSteps({
|
||||
}, [currentModel]);
|
||||
|
||||
const getUpscaleResolution = useCallback(() => {
|
||||
console.log("running");
|
||||
const newDimensions = {
|
||||
width: dimensions.width,
|
||||
height: dimensions.height,
|
||||
|
@ -24,8 +24,12 @@ import { UpscaylCloudModal } from "../components/UpscaylCloudModal";
|
||||
const Home = () => {
|
||||
// STATES
|
||||
const [os, setOs] = useState<"linux" | "mac" | "win" | undefined>(undefined);
|
||||
const [imagePath, SetImagePath] = useState("");
|
||||
const [upscaledImagePath, setUpscaledImagePath] = useState("");
|
||||
const [imagePath, SetImagePath] = useState(
|
||||
"/Users/macbook-air/Downloads/wp9454111_upscayl_4x_realesrgan-x4plus.png"
|
||||
);
|
||||
const [upscaledImagePath, setUpscaledImagePath] = useState(
|
||||
"/Users/macbook-air/Downloads/wp9454111_upscayl_4x_realesrgan-x4plus.png"
|
||||
);
|
||||
const [outputPath, setOutputPath] = useState("");
|
||||
const [scaleFactor] = useState(4);
|
||||
const [progress, setProgress] = useState("");
|
||||
@ -106,6 +110,8 @@ const Home = () => {
|
||||
window.electron.on(commands.UPSCAYL_PROGRESS, (_, data: string) => {
|
||||
if (data.length > 0 && data.length < 10) {
|
||||
setProgress(data);
|
||||
} else if (data.includes("converting")) {
|
||||
setProgress("Scaling and converting image...");
|
||||
}
|
||||
handleErrors(data);
|
||||
logit(`🚧 UPSCAYL_PROGRESS: `, data);
|
||||
@ -645,13 +651,7 @@ const Home = () => {
|
||||
|
||||
<img
|
||||
/* USE REGEX TO GET THE FILENAME AND ENCODE IT INTO PROPER FORM IN ORDER TO AVOID ERRORS DUE TO SPECIAL CHARACTERS */
|
||||
src={
|
||||
"file:///" +
|
||||
imagePath.replace(
|
||||
/([^/\\]+)$/i,
|
||||
encodeURIComponent(imagePath.match(/[^/\\]+$/i)[0])
|
||||
)
|
||||
}
|
||||
src={"file:///" + imagePath}
|
||||
alt="Original"
|
||||
onMouseMove={handleMouseMove}
|
||||
style={{
|
||||
@ -670,15 +670,10 @@ const Home = () => {
|
||||
</p>
|
||||
<img
|
||||
/* USE REGEX TO GET THE FILENAME AND ENCODE IT INTO PROPER FORM IN ORDER TO AVOID ERRORS DUE TO SPECIAL CHARACTERS */
|
||||
src={
|
||||
"file://" +
|
||||
upscaledImagePath.replace(
|
||||
/([^/\\]+)$/i,
|
||||
encodeURIComponent(
|
||||
upscaledImagePath.match(/[^/\\]+$/i)[0]
|
||||
)
|
||||
)
|
||||
}
|
||||
src={"file:///" + upscaledImagePath}
|
||||
onChange={(e) => {
|
||||
console.log(e.currentTarget);
|
||||
}}
|
||||
alt="Upscayl"
|
||||
style={{
|
||||
objectFit: "contain",
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user