tilt shift on windows mashine

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?".
Post Reply
Readbook
Posts: 6
Joined: 2015-06-22T01:44:23-07:00
Authentication code: 6789

tilt shift on windows mashine

Post by Readbook »

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

Re: tilt shift on windows mashine

Post by snibgo »

Each parenthesis ( and ) needs a space on both sides.

If in a BAT file, double each % sign.
snibgo's IM pages: im.snibgo.com
Readbook
Posts: 6
Joined: 2015-06-22T01:44:23-07:00
Authentication code: 6789

Re: tilt shift on windows mashine

Post by Readbook »

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

Re: tilt shift on windows mashine

Post by snibgo »

Use double instead of single quotes.

See http://www.imagemagick.org/Usage/windows/#conversion
snibgo's IM pages: im.snibgo.com
Readbook
Posts: 6
Joined: 2015-06-22T01:44:23-07:00
Authentication code: 6789

Re: tilt shift on windows mashine

Post by Readbook »

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

Code: Select all

"0,0 black 0,%h gray80"
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: tilt shift on windows mashine

Post by snibgo »

If in a BAT file, double each % sign.

Code: Select all

"0,0 black 0,%%h gray80"
snibgo's IM pages: im.snibgo.com
Readbook
Posts: 6
Joined: 2015-06-22T01:44:23-07:00
Authentication code: 6789

Re: tilt shift on windows mashine

Post by Readbook »

i think problem is not in

Code: Select all

"0,0 black 0,%%h gray80"
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

Re: tilt shift on windows mashine

Post by snibgo »

Code: Select all

if %tilt%==true (
So your convert command is within "if ... ( ... )". This means you need to escape the parentheses ( and ) that occur within your convert: ^( and ^).
snibgo's IM pages: im.snibgo.com
Readbook
Posts: 6
Joined: 2015-06-22T01:44:23-07:00
Authentication code: 6789

Re: tilt shift on windows mashine

Post by Readbook »

thank you, I've found same solution in 1 min ago.
Thanks for you help, my script is ready)
Post Reply