mirror of
https://github.com/upscayl/upscayl.git
synced 2024-11-30 18:24:27 +01:00
Fix batch mode JPG Alpha, Rename Fast model & Fix tooltip z-index
This commit is contained in:
parent
e50422c6c5
commit
801755ca9f
@ -2,7 +2,7 @@ export const defaultModelsList = [
|
|||||||
{ label: "General Photo (Real-ESRGAN)", value: "realesrgan-x4plus" },
|
{ label: "General Photo (Real-ESRGAN)", value: "realesrgan-x4plus" },
|
||||||
{
|
{
|
||||||
label: "General Photo (Fast Real-ESRGAN)",
|
label: "General Photo (Fast Real-ESRGAN)",
|
||||||
value: "RealESRGAN_General_x4_v3",
|
value: "realesrgan-x4fast",
|
||||||
},
|
},
|
||||||
{ label: "General Photo (Remacri)", value: "remacri" },
|
{ label: "General Photo (Remacri)", value: "remacri" },
|
||||||
{ label: "General Photo (Ultramix Balanced)", value: "ultramix_balanced" },
|
{ label: "General Photo (Ultramix Balanced)", value: "ultramix_balanced" },
|
||||||
|
@ -53,7 +53,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
|||||||
? customWidth || payload.scale
|
? customWidth || payload.scale
|
||||||
: payload.scale;
|
: payload.scale;
|
||||||
|
|
||||||
const outputFolderName = `upscayl_${model}_${noImageProcessing ? initialScale : desiredScale}${useCustomWidth ? "px_" : "x_"}`;
|
const outputFolderName = `upscayl_${saveImageAs}_${model}_${noImageProcessing ? initialScale : desiredScale}${useCustomWidth ? "px" : "x"}`;
|
||||||
outputFolderPath += slash + outputFolderName;
|
outputFolderPath += slash + outputFolderName;
|
||||||
if (!fs.existsSync(outputFolderPath)) {
|
if (!fs.existsSync(outputFolderPath)) {
|
||||||
fs.mkdirSync(outputFolderPath, { recursive: true });
|
fs.mkdirSync(outputFolderPath, { recursive: true });
|
||||||
@ -148,6 +148,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
|||||||
let upscaledImagePath = `${outputFolderPath}${slash}${removeFileExtension(
|
let upscaledImagePath = `${outputFolderPath}${slash}${removeFileExtension(
|
||||||
file,
|
file,
|
||||||
)}.${saveImageAs}`;
|
)}.${saveImageAs}`;
|
||||||
|
let imageIsAlpha = false;
|
||||||
if (
|
if (
|
||||||
isAlpha &&
|
isAlpha &&
|
||||||
saveImageAs === "jpg" &&
|
saveImageAs === "jpg" &&
|
||||||
@ -155,6 +156,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
|||||||
`${outputFolderPath}${slash}${removeFileExtension(file)}.jpg.png`,
|
`${outputFolderPath}${slash}${removeFileExtension(file)}.jpg.png`,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
imageIsAlpha = true;
|
||||||
console.log("This is an Alpha image!");
|
console.log("This is an Alpha image!");
|
||||||
upscaledImagePath = `${outputFolderPath}${slash}${removeFileExtension(file)}.jpg.png`;
|
upscaledImagePath = `${outputFolderPath}${slash}${removeFileExtension(file)}.jpg.png`;
|
||||||
}
|
}
|
||||||
@ -166,6 +168,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
|||||||
)}.${saveImageAs}`,
|
)}.${saveImageAs}`,
|
||||||
desiredScale,
|
desiredScale,
|
||||||
saveImageAs,
|
saveImageAs,
|
||||||
|
imageIsAlpha,
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
isAlpha &&
|
isAlpha &&
|
||||||
|
@ -10,11 +10,30 @@ const convertAndScale = async (
|
|||||||
processedImagePath: string,
|
processedImagePath: string,
|
||||||
scale: string,
|
scale: string,
|
||||||
saveImageAs: ImageFormat,
|
saveImageAs: ImageFormat,
|
||||||
|
imageIsAlpha?: boolean,
|
||||||
) => {
|
) => {
|
||||||
if (!customWidth && scale === "4" && compression === 0) {
|
// Skip conversion when the scale is 4x and compression is 0
|
||||||
|
// - When output format is WebP or PNG
|
||||||
|
// - When the image is not alpha and the output format is JPEG
|
||||||
|
if (
|
||||||
|
!customWidth &&
|
||||||
|
(saveImageAs === "png" || saveImageAs === "webp") &&
|
||||||
|
scale === "4" &&
|
||||||
|
compression === 0
|
||||||
|
) {
|
||||||
|
logit("Skipping compression for 4x scale and 0% compression");
|
||||||
|
return;
|
||||||
|
} else if (
|
||||||
|
!customWidth &&
|
||||||
|
saveImageAs === "jpg" &&
|
||||||
|
scale === "4" &&
|
||||||
|
compression === 0 &&
|
||||||
|
!imageIsAlpha
|
||||||
|
) {
|
||||||
logit("Skipping compression for 4x scale and 0% compression");
|
logit("Skipping compression for 4x scale and 0% compression");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let originalImage: Metadata | undefined;
|
let originalImage: Metadata | undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -311,7 +311,7 @@ function LeftPaneImageSteps({
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Tooltip className="max-w-sm" id="tooltip" />
|
<Tooltip className="z-50 max-w-sm" id="tooltip" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user