Page 3 of 3

Re: How to batch composite / round corners?

Posted: 2016-08-27T13:23:56-07:00
by snibgo
When you are debugging code, don't "echo off". That's just making things harder for yourself.

You should also say what (if any) error messages you get.

One problem is that you need to escape the parentheses that are within your "convert" : ^( and ^)

EDIT: Or put them in quotes: "(" and ")".

Re: How to batch composite / round corners?

Posted: 2016-08-27T14:05:53-07:00
by imagefox87
I turned off the echo. However, the script runs fast and then closes. I have no output in my output folder. No errors seen. I added ^ before ( and after ).

Code: Select all

for %%g in (*.png) do ^(
	convert %%g
	^( -size 25x25 xc:black -fill white ^
	   -draw "circle 25,25 25,0" -alpha off ^
	   -write mpr:corner +delete ) ^
	^( -clone 0 -fill white -colorize 100%% ^
	   ^( mpr:corner ) -gravity northwest -compose over -composite ^
	   ^( mpr:corner -rotate 90 )^ -gravity northeast -compose over -composite ^
	   ^( mpr:corner -rotate 180 )^ -gravity southeast -compose over -composite ^
	   ^( mpr:corner -rotate 270 )^ -gravity southwest -compose over -composite ) ^
	-alpha off -compose copy_opacity -composite -compose over ^
	^( +clone -background black -shadow 80x3+5+5 ) ^
	+swap -background none -layers merge +repage  "batch/%%g" ^
)

Re: How to batch composite / round corners?

Posted: 2016-08-27T14:18:29-07:00
by fmw42
You have your ^ in the wrong places. They need to come before the ( and before the ) and not after. Also one is missing all together. Look carefully at you code.

You have

Code: Select all

^( mpr:corner -rotate 90 )^
And it should be

Code: Select all

^( mpr:corner -rotate 90 ^)

You also have

Code: Select all

^( mpr:corner )
and it should be

Code: Select all

^( mpr:corner ^)

Escaping means put a special character before the one you want to protect.

Re: How to batch composite / round corners?

Posted: 2016-08-27T14:21:33-07:00
by imagefox87
Ok thanks fixed, but I still have no output:

Code: Select all

for %%g in (*.png) do ^(
	convert %%g
	^( -size 25x25 xc:black -fill white ^
	   -draw "circle 25,25 25,0" -alpha off ^
	   -write mpr:corner +delete ^)
	^( -clone 0 -fill white -colorize 100%% ^
	   ^( mpr:corner ^) -gravity northwest -compose over -composite ^
	   ^( mpr:corner -rotate 90 ^) -gravity northeast -compose over -composite ^
	   ^( mpr:corner -rotate 180 ^) -gravity southeast -compose over -composite ^
	   ^( mpr:corner -rotate 270 ^) -gravity southwest -compose over -composite ^)
	-alpha off -compose copy_opacity -composite -compose over ^
	^( +clone -background black -shadow 80x3+5+5 ^)
	+swap -background none -layers merge +repage  "batch/%%g" ^
^)

Re: How to batch composite / round corners?

Posted: 2016-08-27T14:33:22-07:00
by snibgo
imagefox87 wrote:for %%g in (*.png) do ^(
No. I said:
snibgo wrote:need to escape the parentheses that are within your "convert"
Not the ones that are outside.

Re: How to batch composite / round corners?

Posted: 2016-08-27T14:36:28-07:00
by imagefox87
@snibgo, I took out the ^ outside the convert. Still no output.

Code: Select all

for %%g in (*.png) do (
	convert %%g
	null: ^
	^( -size 25x25 xc:black -fill white ^
	   -draw "circle 25,25 25,0" -alpha off ^
	   -write mpr:corner +delete ^)
	^( -clone 0 -fill white -colorize 100%% ^
	   ^( mpr:corner ^) -gravity northwest -compose over -composite ^
	   ^( mpr:corner -rotate 90 ^) -gravity northeast -compose over -composite ^
	   ^( mpr:corner -rotate 180 ^) -gravity southeast -compose over -composite ^
	   ^( mpr:corner -rotate 270 ^) -gravity southwest -compose over -composite ^)
	-alpha off -compose copy_opacity -composite -compose over ^
	^( +clone -background black -shadow 80x3+5+5 ^)
	+swap -background none -layers merge +repage  "batch/%%g" ^
)

Re: How to batch composite / round corners?

Posted: 2016-08-27T14:44:39-07:00
by fmw42
you need a ^ after convert %%g at the end of that line. It represents a continuation to a new line and you have a new line after that.

you also need one after

Code: Select all

^( mpr:corner -rotate 270 ^) -gravity southwest -compose over -composite ^)
I do not think you need one at "batch/%%g" ^, but it probably does not matter there

Re: How to batch composite / round corners?

Posted: 2016-08-27T15:06:58-07:00
by imagefox87
Ok here are my errors after adding all the ^ at the right places:

Code: Select all

'(' is not a recognized as an internal or external command,
operable program or batch file.
'+swap'is not recognized is an internal or external command,
operable program or batch file.

Code: Select all

for %%g in (*.png) do (
	convert %%g ^
	null: ^
	^( -size 25x25 xc:black -fill white ^
	   -draw "circle 25,25 25,0" -alpha off ^
	   -write mpr:corner +delete ^)
	^( -clone 0 -fill white -colorize 100%% ^
	   ^( mpr:corner ^) -gravity northwest -compose over -composite ^
	   ^( mpr:corner -rotate 90 ^) -gravity northeast -compose over -composite ^
	   ^( mpr:corner -rotate 180 ^) -gravity southeast -compose over -composite ^
	   ^( mpr:corner -rotate 270 ^) -gravity southwest -compose over -composite ^) ^
	-alpha off -compose copy_opacity -composite -compose over ^
	^( +clone -background black -shadow 80x3+5+5 ^)
	+swap -background none -layers merge +repage  "batch/%%g"
)
Maybe I should just convert the original UNIX shell script to Windows bat.
There was a link in one recent post to a file that converts Linux shell scripts to Windows batch files.
Can anyone please tell me where it is? Because it doesn't show in search results.

Re: How to batch composite / round corners?

Posted: 2016-08-27T15:40:54-07:00
by snibgo
Jeepers. You need a ^ at the end of each line that logically should be attached to the next one.
'(' is not a recognized as an internal or external command,
operable program or batch file.
This means that Windows isn't passing the open-parens to IM, because the previous line hasn't been continued by a caret character.

Re: How to batch composite / round corners?

Posted: 2016-08-27T15:53:26-07:00
by imagefox87
Ok, I finally got it to work. Just needed more ^ everywhere! Thank you everyone.

Re: How to batch composite / round corners?

Posted: 2016-08-28T19:48:14-07:00
by rossdv8
This is cleaner than my effort :-)