-
Notifications
You must be signed in to change notification settings - Fork 0
/
JPG-JXL.bat
76 lines (68 loc) · 1.58 KB
/
JPG-JXL.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
@echo off
SETlocal EnableExtensions
SETlocal EnableDelayedExpansion
TITLE JXL lossless batch converter - By 3DJ
SET InputFormat=JPG
pushd "%~dp0"
IF NOT "%~1"=="" (
IF EXIST "%~1/*" (
CD "%~1"
pushd "%~1"
SET "OutputPath=%~1\"
) ELSE (
For %%A in ("%~1") do (
CALL :Convert %%A "%%~dpA%%~nA.jxl"
PAUSE
EXIT
)
)
)
ECHO.
ECHO Press any key to convert all the !InputFormat! files in this folder and subfolders
ECHO Output format: JXL lossless
IF DEFINED OutputPath (
ECHO Output folder: !OutputPath!
) ELSE (
ECHO Output folder: JXL\
)
ECHO Folder structure: Same as input relative path
ECHO.
ECHO - To generate JXL files in the same folder as the input files,
ECHO close this window and drag the folder/file into the .bat file.
ECHO - Existing JXL files will be skipped,
ECHO so you can stop and resume batch conversion later if needed.
PAUSE >NUL
ECHO.
FOR /R %%A in (*.*) do (
IF /I "%%~xA"==".!InputFormat!" (
SET "OutputPath=%%~dpA"
IF "%~1"=="" (
SET "OutputPath=%~dp0JXL\!OutputPath:%~dp0=!"
IF NOT EXIST "!OutputPath!" (
MKDIR "!OutputPath!"
)
)
CALL :Convert "%%A" "!OutputPath!%%~nA.jxl"
)
)
ECHO Press any key to open the output folder
PAUSE
"!OutputPath!"
:Convert
IF NOT EXIST %2 (
CALL :Encode %1 %2
) ELSE (
For %%F in (%2) do (SET Filesize=%%~zF)
if !Filesize! EQU 0 (
ECHO %2 already exists, but seems corrupted/empty. Re-converting...
CALL :Encode %1 %2
) ELSE (
ECHO %2 already exists. Skipping...
)
)
EXIT /B
:Encode
ECHO Encoding %2
"%~dp0Converters/cjxl.exe" %1 %2 --verbose --quality=100 --effort=9
ECHO.
EXIT /B