Created
February 19, 2023 13:29
-
-
Save veteran29/4c975afee00b2a9012ce414210ef1ea9 to your computer and use it in GitHub Desktop.
OCR
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 | |
rem the name of the script is drive path name of the Parameter %0 | |
rem (= the batch file) but with the extension ".ps1" | |
set PSScript=%~dpn0.ps1 | |
set args=%1 | |
:More | |
shift | |
if '%1'=='' goto Done | |
set args=%args%, %1 | |
goto More | |
:Done | |
powershell.exe -NoExit -Command "& '%PSScript%' '%args%'" |
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
$files = $args[0].Split(',') | % {$_.Trim()} | |
$threshold = '55%' | |
foreach ($file in $files) { | |
Write-Host "Converting $file" | |
magick convert $file ` | |
-type Grayscale -threshold $threshold ` | |
-define connected-components:area-threshold=3 ` | |
-define connected-components:mean-color=true ` | |
-connected-components 8 ` | |
"$file.png" | |
} | |
Write-Host "`nFiles converted" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment