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 (Fast Real-ESRGAN)",
|
||||
value: "RealESRGAN_General_x4_v3",
|
||||
value: "realesrgan-x4fast",
|
||||
},
|
||||
{ label: "General Photo (Remacri)", value: "remacri" },
|
||||
{ label: "General Photo (Ultramix Balanced)", value: "ultramix_balanced" },
|
||||
|
@ -53,7 +53,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
||||
? customWidth || 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;
|
||||
if (!fs.existsSync(outputFolderPath)) {
|
||||
fs.mkdirSync(outputFolderPath, { recursive: true });
|
||||
@ -148,6 +148,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
||||
let upscaledImagePath = `${outputFolderPath}${slash}${removeFileExtension(
|
||||
file,
|
||||
)}.${saveImageAs}`;
|
||||
let imageIsAlpha = false;
|
||||
if (
|
||||
isAlpha &&
|
||||
saveImageAs === "jpg" &&
|
||||
@ -155,6 +156,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
||||
`${outputFolderPath}${slash}${removeFileExtension(file)}.jpg.png`,
|
||||
)
|
||||
) {
|
||||
imageIsAlpha = true;
|
||||
console.log("This is an Alpha image!");
|
||||
upscaledImagePath = `${outputFolderPath}${slash}${removeFileExtension(file)}.jpg.png`;
|
||||
}
|
||||
@ -166,6 +168,7 @@ const batchUpscayl = async (event, payload: BatchUpscaylPayload) => {
|
||||
)}.${saveImageAs}`,
|
||||
desiredScale,
|
||||
saveImageAs,
|
||||
imageIsAlpha,
|
||||
);
|
||||
if (
|
||||
isAlpha &&
|
||||
|
@ -10,11 +10,30 @@ const convertAndScale = async (
|
||||
processedImagePath: string,
|
||||
scale: string,
|
||||
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");
|
||||
return;
|
||||
}
|
||||
|
||||
let originalImage: Metadata | undefined;
|
||||
|
||||
try {
|
||||
|
@ -311,7 +311,7 @@ function LeftPaneImageSteps({
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<Tooltip className="max-w-sm" id="tooltip" />
|
||||
<Tooltip className="z-50 max-w-sm" id="tooltip" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user