I have the script:
convert a.jpg ( -clone 0 -fill white -colorize 100 -fill black -draw "polygon 500,300 500,1500 1300,1500 1300,300" -alpha off -write mpr:mask +delete ) -mask mpr:mask +repage -threshold 50% -morphology open square:4 +mask c.jpg
which happily takes my image, makes a mask, and does what I need it to do, on a per image basis, using an original filename for the input, and a new filename for the output.
However, I'm trying to get this to run on every image in a folder, and I'm having zero luck...
I have tried many .bat files, such as:
@echo on
setlocal enabledelayedexpansion
set img_folder=C:\me\pics\
set output_folder=C:\me\pics\cropped
for /f "delims=" %%i in ('dir /b "%img_folder%\*.jpg"') do (
set input_file=%img_folder%\%%i
set output_file=%output_folder%\%%i
convert %input_file% ( -clone 0 -fill white -colorize 100 -fill black -draw "polygon 500,300 500,1500 1300,1500 1300,300" -alpha off -write mpr:mask +delete ) -mask mpr:mask +repage -threshold 50% -morphology open square:4 +mask %output_file%
)
pause
However, something about the brackets seems to be messing with everything else, as the bracket after +delete is pairing up in sublimetext with the bracket after "do" in the for loop.
I'm really stumped, I've tried everything I can think of, and could really use some help, if anyone can offer a simple solution, I'd be very much appreciative!