Last active
February 19, 2023 03:47
-
-
Save mr-bo-jangles/93fa2d68c8567e62809e007080bf6aba to your computer and use it in GitHub Desktop.
Parallel Batch Extracter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
Setlocal EnableDelayedExpansion | |
mkdir images | |
set count=1 | |
xcopy /Q /Y #TOOLS#\pdfimages.exe . >NUL | |
xcopy /Q /Y #TOOLS#\rush.exe . >NUL | |
echo Extracting PPM formatted images from supplied PDFs | |
dir /b *.pdf | .\rush --eta -j 8 -T b ".\pdfimages \"{}\" images\{#}" -q | |
:del1 | |
del pdfimages.exe 2>NUL | |
del rush.exe 2>NUL | |
if exist pdfimages.exe goto del1 | |
if exist rush.exe goto del1 | |
cd images | |
echo Converting images from PPM to PNG... | |
xcopy /Q /Y ..\#TOOLS#\mogrify.exe . >NUL | |
xcopy /Q /Y ..\#TOOLS#\rush.exe . >NUL | |
xcopy /Q /Y ..\#TOOLS#\*.dll . >NUL | |
dir /b *.ppm | .\rush --eta -j 8 ".\mogrify -format png {}" >NUL | |
:del2 | |
del mogrify.exe 2>NUL | |
del rush.exe 2>NUL | |
if exist mogrify.exe goto del2 | |
if exist rush.exe goto del2 | |
del *.dll 2>NUL | |
echo Removing old images... | |
del *.ppm 2>NUL | |
echo Purging small images... | |
xcopy /Q /Y ..\#TOOLS#\purgesmallimages.exe . >NUL | |
.\purgesmallimages 200 | |
:del3 | |
del purgesmallimages.exe 2>NUL | |
if exist purgesmallimages.exe goto del3 | |
echo Now manually delete all unneeded images and press enter. Before you press enter the images directory should contain an even amount of images, and they should be in the order image, mask, image, mask, image, mask... | |
pause | |
xcopy /Q /Y ..\#TOOLS#\masker.exe . >NUL | |
xcopy /Q /Y ..\#TOOLS#\convert.exe . >NUL | |
xcopy /Q /Y ..\#TOOLS#\*.dll . >NUL | |
.\masker | |
:del4 | |
del masker.exe 2>NUL | |
del convert.exe 2>NUL | |
del *.dll 2>NUL | |
if exist masker.exe goto del4 | |
if exist convert.exe goto del4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment