Skip to content

Commit

Permalink
Update converters
Browse files Browse the repository at this point in the history
  • Loading branch information
ThreeDeeJay committed Nov 5, 2023
1 parent 0b64a4f commit a1a8ae3
Show file tree
Hide file tree
Showing 8 changed files with 311 additions and 4 deletions.
2 changes: 1 addition & 1 deletion JPG-JXL.bat
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ EXIT /B

:Encode
ECHO Encoding %2
"%~dp0cjxl.exe" %1 %2 --verbose --quality=100 --effort=9
"%~dp0Converters/cjxl.exe" %1 %2 --verbose --quality=100 --effort=9
ECHO.
EXIT /B
2 changes: 1 addition & 1 deletion JPS-JXL.bat
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ EXIT /B

:Encode
ECHO Encoding %2
"%~dp0cjxl.exe" %1 %2 --verbose --quality=100 --effort=9
"%~dp0Converters/cjxl.exe" %1 %2 --verbose --quality=100 --effort=9
ECHO.
EXIT /B
76 changes: 76 additions & 0 deletions JXL-JPG.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
@echo off

SETlocal EnableExtensions
SETlocal EnableDelayedExpansion

TITLE JPG lossless batch converter - By 3DJ

SET InputFormat=JXL

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.jpg"
PAUSE
EXIT
)
)
)

ECHO.
ECHO Press any key to convert all the !InputFormat! files in this folder and subfolders
ECHO Output format: JPG lossless
IF DEFINED OutputPath (
ECHO Output folder: !OutputPath!
) ELSE (
ECHO Output folder: JPG\
)
ECHO Folder structure: Same as input relative path
ECHO.
ECHO - To generate JPG files in the same folder as the input files,
ECHO close this window and drag the folder/file into the .bat file.
ECHO - Existing JPG 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=%~dp0JPG\!OutputPath:%~dp0=!"
IF NOT EXIST "!OutputPath!" (
MKDIR "!OutputPath!"
)
)
CALL :Convert "%%A" "!OutputPath!%%~nA.jpg"
)
)
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/djxl.exe" %1 %2
ECHO.
EXIT /B
79 changes: 79 additions & 0 deletions JXL-JPS.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
@echo off

SETlocal EnableExtensions
SETlocal EnableDelayedExpansion

TITLE JPS lossless batch converter - By 3DJ

SET InputFormat=JXL

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.jpg"
PAUSE
EXIT
)
)
)

ECHO.
ECHO Press any key to convert all the !InputFormat! files in this folder and subfolders
ECHO Output format: JPS lossless
IF DEFINED OutputPath (
ECHO Output folder: !OutputPath!
) ELSE (
ECHO Output folder: JPS\
)
ECHO Folder structure: Same as input relative path
ECHO.
ECHO - To generate JPS files in the same folder as the input files,
ECHO close this window and drag the folder/file into the .bat file.
ECHO - Existing JPS 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=%~dp0JPS\!OutputPath:%~dp0=!"
IF NOT EXIST "!OutputPath!" (
MKDIR "!OutputPath!"
)
)
CALL :Convert "%%A" "!OutputPath!%%~nA.jps"
)
)
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/djxl.exe" %1 %2
For %%O in ("%~2") do (
Move %2 "%%~dpA%%~nA.jps"
)
ECHO.
EXIT /B
2 changes: 1 addition & 1 deletion PNG-WebP.bat
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ EXIT /B

:Encode
ECHO Encoding %2
"%~dp0cwebp.exe" -v -mt -noasm -metadata all -progress -lossless -z 8 -m 6 -q 99 %1 -o %2
"%~dp0Converters/cwebp.exe" -v -mt -noasm -metadata all -progress -lossless -z 8 -m 6 -q 99 %1 -o %2
ECHO.
EXIT /B
2 changes: 1 addition & 1 deletion PNS-WebP.bat
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ EXIT /B

:Encode
ECHO Encoding %2
"%~dp0cwebp.exe" -v -mt -noasm -metadata all -progress -lossless -z 8 -m 6 -q 99 %1 -o %2
"%~dp0Converters/cwebp.exe" -v -mt -noasm -metadata all -progress -lossless -z 8 -m 6 -q 99 %1 -o %2
ECHO.
EXIT /B
76 changes: 76 additions & 0 deletions WebP-PNG.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
@echo off

SETlocal EnableExtensions
SETlocal EnableDelayedExpansion

TITLE PNS lossless batch converter - By 3DJ

SET InputFormat=WebP

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.png"
PAUSE
EXIT
)
)
)

ECHO.
ECHO Press any key to convert all the !InputFormat! files in this folder and subfolders
ECHO Output format: PNS lossless
IF DEFINED OutputPath (
ECHO Output folder: !OutputPath!
) ELSE (
ECHO Output folder: PNS\
)
ECHO Folder structure: Same as input relative path
ECHO.
ECHO - To generate PNS files in the same folder as the input files,
ECHO close this window and drag the folder/file into the .bat file.
ECHO - Existing PNS 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=%~dp0PNS\!OutputPath:%~dp0=!"
IF NOT EXIST "!OutputPath!" (
MKDIR "!OutputPath!"
)
)
CALL :Convert "%%A" "!OutputPath!%%~nA.pns"
)
)
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/dwebp.exe" %1 -o %2
ECHO.
EXIT /B
76 changes: 76 additions & 0 deletions WebP-PNS.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
@echo off

SETlocal EnableExtensions
SETlocal EnableDelayedExpansion

TITLE PNS lossless batch converter - By 3DJ

SET InputFormat=WebP

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.pns"
PAUSE
EXIT
)
)
)

ECHO.
ECHO Press any key to convert all the !InputFormat! files in this folder and subfolders
ECHO Output format: PNS lossless
IF DEFINED OutputPath (
ECHO Output folder: !OutputPath!
) ELSE (
ECHO Output folder: PNS\
)
ECHO Folder structure: Same as input relative path
ECHO.
ECHO - To generate PNS files in the same folder as the input files,
ECHO close this window and drag the folder/file into the .bat file.
ECHO - Existing PNS 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=%~dp0PNS\!OutputPath:%~dp0=!"
IF NOT EXIST "!OutputPath!" (
MKDIR "!OutputPath!"
)
)
CALL :Convert "%%A" "!OutputPath!%%~nA.pns"
)
)
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/dwebp.exe" %1 -o %2
ECHO.
EXIT /B

0 comments on commit a1a8ae3

Please sign in to comment.