How to batch composite / round corners?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to batch composite / round corners?
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 ")".
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 ")".
snibgo's IM pages: im.snibgo.com
-
- Posts: 20
- Joined: 2016-08-26T13:37:18-07:00
- Authentication code: 1151
Re: How to batch composite / round corners?
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" ^
)
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to batch composite / round corners?
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
And it should be
You also have
and it should be
Escaping means put a special character before the one you want to protect.
You have
Code: Select all
^( mpr:corner -rotate 90 )^
Code: Select all
^( mpr:corner -rotate 90 ^)
You also have
Code: Select all
^( mpr:corner )
Code: Select all
^( mpr:corner ^)
Escaping means put a special character before the one you want to protect.
-
- Posts: 20
- Joined: 2016-08-26T13:37:18-07:00
- Authentication code: 1151
Re: How to batch composite / round corners?
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" ^
^)
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to batch composite / round corners?
No. I said:imagefox87 wrote:for %%g in (*.png) do ^(
Not the ones that are outside.snibgo wrote:need to escape the parentheses that are within your "convert"
snibgo's IM pages: im.snibgo.com
-
- Posts: 20
- Joined: 2016-08-26T13:37:18-07:00
- Authentication code: 1151
Re: How to batch composite / round corners?
@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" ^
)
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to batch composite / round corners?
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
I do not think you need one at "batch/%%g" ^, but it probably does not matter there
you also need one after
Code: Select all
^( mpr:corner -rotate 270 ^) -gravity southwest -compose over -composite ^)
-
- Posts: 20
- Joined: 2016-08-26T13:37:18-07:00
- Authentication code: 1151
Re: How to batch composite / round corners?
Ok here are my errors after adding all the ^ at the right places:
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.
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"
)
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.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to batch composite / round corners?
Jeepers. You need a ^ at the end of each line that logically should be attached to the next one.
This means that Windows isn't passing the open-parens to IM, because the previous line hasn't been continued by a caret character.'(' is not a recognized as an internal or external command,
operable program or batch file.
snibgo's IM pages: im.snibgo.com
-
- Posts: 20
- Joined: 2016-08-26T13:37:18-07:00
- Authentication code: 1151
Re: How to batch composite / round corners?
Ok, I finally got it to work. Just needed more ^ everywhere! Thank you everyone.
Re: How to batch composite / round corners?
This is cleaner than my effort