Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Readbook
Posts: 6 Joined: 2015-06-22T01:44:23-07:00
Authentication code: 6789
Post
by Readbook » 2015-06-22T02:48:54-07:00
Hi there.
I am trying to use tilt-shift script:
Code: Select all
convert beijing_md.jpg -sigmoidal-contrast 15x30% \
\( +clone -sparse-color Barycentric '0,0 black 0,%h gray80' \
-solarize 50% -level 50%,0 -write mpr:blur_map \) \
-compose Blur -set option:compose:args 10x0 -composite \
mpr:blur_map \
-compose Blur -set option:compose:args 0x10 -composite \
beijing_model_2pass.jpg
so on my opinion on windows it looks like these:
Code: Select all
convert c:\del\00000001.JPG -sigmoidal-contrast 15x30%( +clone -sparse-color Barycentric '0,0 black 0,%h gray80' -solarize 50% -level 50%,0 -write mpr:blur_map) -compose Blur -set option:compose:args 10x0 -composite mpr:blur_map -compose Blur -set option:compose:args 0x10 -composite c:\del\000000011.JPG
but i've got error:
Code: Select all
convert.exe: invalid argument for option `sparse-color': Invalid number of Argum
ents @ error/mogrify.c/SparseColorOption/519.
convert.exe: unable to open image `black': No such file or directory @ error/blo
b.c/OpenBlob/2695.
convert.exe: no decode delegate for this image format `' @ error/constitute.c/Re
adImage/501.
convert.exe: unable to open image `0,%h': No such file or directory @ error/blob
.c/OpenBlob/2695.
convert.exe: no decode delegate for this image format `' @ error/constitute.c/Re
adImage/501.
convert.exe: unable to open image `gray80'': No such file or directory @ error/b
lob.c/OpenBlob/2695.
convert.exe: no decode delegate for this image format `' @ error/constitute.c/Re
adImage/501.
convert.exe: unable to get registry ID `blur_map' @ error/registry.c/GetImageReg
istry/201.
convert.exe: no images defined `c:\del\0000000111.JPG' @ error/convert.c/Convert
ImageCommand/3212.
I use ImageMagick-6.9.1-6-Q16-x64-dll.exe via windows 7 x64
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2015-06-22T03:26:34-07:00
Each parenthesis ( and ) needs a space on both sides.
If in a BAT file, double each % sign.
Readbook
Posts: 6 Joined: 2015-06-22T01:44:23-07:00
Authentication code: 6789
Post
by Readbook » 2015-06-22T03:38:21-07:00
using in cmd, no BAT.
Trying threre(with space), no effect, same error
Code: Select all
convert c:\del\00000001.JPG -sigmoidal-contrast 15x30% ( +clone -sparse-color Barycentric '0,0 black 0,%h gray80' -solarize 50% -level 50%,0 -write mpr:blur_map ) -compose Blur -set option:compose:args 10x0 -composite mpr:blur_map -compose Blur -set option:compose:args 0x10 -composite c:\del\000000011.JPG
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2015-06-22T04:06:16-07:00
Readbook
Posts: 6 Joined: 2015-06-22T01:44:23-07:00
Authentication code: 6789
Post
by Readbook » 2015-06-22T06:18:58-07:00
thanks, it's start working in cmd.
But when I put it into bat it stops workink.
I have path to files in %pyt1%\Def
Code: Select all
MD "%pyt1%Def\small"
FOR %%a in (%pyt1%Def\*.JPG) DO c:\imagemagick\convert.exe %%a -sigmoidal-contrast 15x30%% ( +clone -sparse-color Barycentric "0,0 black 0,%h gray80" -solarize 50%% -level 50%%,0 -write mpr:blur_map ) -compose Blur -set option:compose:args 10x0 -composite mpr:blur_map -compose Blur -set option:compose:args 0x10 -composite "%pyt1%Def\small\%%~nxa"
I try many combination with call and one or two %%.
I read all examples in
http://www.imagemagick.org/Usage/windows/#conversion but don't saw any examples with parametr such as
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2015-06-22T06:38:34-07:00
If in a BAT file, double each % sign.
Readbook
Posts: 6 Joined: 2015-06-22T01:44:23-07:00
Authentication code: 6789
Post
by Readbook » 2015-06-22T07:08:46-07:00
i think problem is not in
I tested, and it works well with double %
I think problem is in ()
here is full command
Code: Select all
if %tilt%==true (
MD "%pyt1%Def\small"
FOR %%a in (%pyt1%Def\*.JPG) DO c:\imagemagick\convert.exe %%a -sigmoidal-contrast 15x30%% ( +clone -sparse-color Barycentric "0,0 black 0,%%h gray80" -write mpr:blur_map ) -compose Blur -set option:compose:args 10x0 -composite mpr:blur_map -compose Blur -set option:compose:args 0x10 %pyt1%Def\small\%%~nxa
pause
)
I've got error:
unexpected appearance -compose
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2015-06-22T07:14:55-07:00
So your convert command is within "if ... ( ... )". This means you need to escape the parentheses ( and ) that occur within your convert: ^( and ^).
Readbook
Posts: 6 Joined: 2015-06-22T01:44:23-07:00
Authentication code: 6789
Post
by Readbook » 2015-06-22T07:16:14-07:00
thank you, I've found same solution in 1 min ago.
Thanks for you help, my script is ready)