Code: Select all
convert -crop 1x2@ +repage +adjoin %* *.jpg
Travis
Code: Select all
convert -crop 1x2@ +repage +adjoin %* *.jpg
Code: Select all
convert -crop 1x2@ +repage +adjoin %* *.jpg
ren *-0.jpg *-L.jpg
ren *-1.jpg *-R.jpg
I'm a hack at best when it comes to writing scripts. I need to be able to drag and drop images onto the script with no additional input as others besides myself will be using this script. This is currently working well, not sure if that is a fluke or not.fmw42 wrote:It is generally not a good idea to use wildcards for both input and output.
I agree, but that's not happening here. In a Windows BAT script, "%*" is equivalent to bash "$*", expanding to the positional parameters of the script.fmw42 wrote:It is generally not a good idea to use wildcards for both input and output.
It is a fluke. You are using bad syntax (which just happens to work, for now). You should read files, process the images, then write them to files.CrazyHomelessGuy wrote:... not sure if that is a fluke or not.
As snibgo mentioned, if it's working, it's accidental and not by design. You might consider using proper form so if you upgrade your IM or run it on a different machine with a different version of IM it won't break the script. You can make a Windows script like this...CrazyHomelessGuy wrote:I'm a hack at best when it comes to writing scripts. I need to be able to drag and drop images onto the script with no additional input as others besides myself will be using this script. This is currently working well, not sure if that is a fluke or not.
Code: Select all
@echo off
pushd "%~dp1"
convert "%~1" ^
-crop 1x2@ -write mpr:img -delete 0--1 ^
mpr:img[0] -write "%~n1-L.jpg" +delete ^
mpr:img[1] "%~n1-R.jpg"
popd
exit /b
GeeMack wrote:As snibgo mentioned, if it's working, it's accidental and not by design. You might consider using proper form so if you upgrade your IM or run it on a different machine with a different version of IM it won't break the script. You can make a Windows script like this...CrazyHomelessGuy wrote:I'm a hack at best when it comes to writing scripts. I need to be able to drag and drop images onto the script with no additional input as others besides myself will be using this script. This is currently working well, not sure if that is a fluke or not.
... and name it something like "stereosplit.bat". Then drag and drop any image on it, or even on a shortcut to it. It will split the image into an upper half and a lower half. It will save them as JPG images in the folder where the image resides. It will name them with their original filename but ending with a "-L.jpg" or a "-R.jpg".Code: Select all
@echo off pushd "%~dp1" convert "%~1" ^ -crop 1x2@ -write mpr:img -delete 0--1 ^ mpr:img[0] -write "%~n1-L.jpg" +delete ^ mpr:img[1] "%~n1-R.jpg" popd exit /b