Skip to content

Instantly share code, notes, and snippets.

@olexs
Created May 23, 2021 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olexs/5df9074495ca46209af95bd58a98c994 to your computer and use it in GitHub Desktop.
Save olexs/5df9074495ca46209af95bd58a98c994 to your computer and use it in GitHub Desktop.
Convert a PDF to JPG image(s) optimized for quick transfer via fax (specifically Fritz!Box built-in fax)
@echo off
setlocal enabledelayedexpansion
:top
if (%1) == () goto end
echo Extracting single page images from "%1"...
"imagemagick\convert.exe" -density 150 %1 "%~dpn1.fax.bmp"
for %%f in (.\*.fax*.bmp) do (
echo Post-processing "%%~dpnf"...
"imagemagick\convert.exe" "%%f" -colorspace gray ^( +clone -blur 5,5 ^) -compose Divide_Src -composite -normalize -threshold 80%% "%%~dpnf.jpg"
del "%%f"
)
shift
goto top
:end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment