Re: Implement This Filter
Posted: 2013-11-02T18:57:22-07:00
These are all Windows "bat" commands, not bash. Paste them into a file and execute it. For example, paste into a file called "hello.bat" than at the command line type "hello".
Use https://github.com/ImageMagick/ImageMagick/discussions instead.
https://imagemagick.com/discourse-server/
https://imagemagick.com/discourse-server/viewtopic.php?t=24377
Yes. I meant bat. How to implement it at command prompt ?snibgo wrote:These are all Windows "bat" commands, not bash. Paste them into a file and execute it. For example, paste into a file called "hello.bat" than at the command line type "hello".
Code: Select all
FOR /F "usebackq" %L IN (`identify -format "WIDTH=%w\nHEIGHT=%h" e.jpg`) DO set %L
FOR /F %i IN ('identify -ping -format "%[fx:max(%WIDTH%,%HEIGHT%)]" xc:') DO set MAX=%i
FOR /F %i IN ('identify -ping -format "%[fx:int(%MAX%*sqrt(2)+0.5)]" xc:') DO set DIM=%i
convert -size %DIM%x%DIM% radial-gradient: -gravity Center -crop %MAX%x%MAX%+0+0 +repage -resize "%WIDTH%x%HEIGHT%^!" vig_mask.png
Code: Select all
D:\web\im> FOR /F "usebackq" %L IN (`identify -format "WIDTH=%w\nHEIGHT=%h" e.jpg`) DO set %L
D:\web\im>set WIDTH=334
D:\web\im>set HEIGHT=334
D:\web\im> FOR /F %i IN ('identify -ping -format "%[fx:max(%WIDTH%,%HEIGHT%)]" xc:') DO set MAX=%i
D:\web\im>set MAX=334
D:\web\im> FOR /F %i IN ('identify -ping -format "%[fx:int(%MAX%*sqrt(2)+0.5)]" xc:') DO set DIM=%i
D:\web\im>set DIM=472
D:\web\im> convert -size %DIM%x%DIM% radial-gradient: -gravity Center -crop%MAX%x%MAX%+0+0 +repage -resize "%WIDTH%x%HEIGHT%^!" vig_mask.png
Width and Height are getting set. But MAX and DIM are not getting setsnibgo wrote:Pasting those commands into a command window works fine for me.The values for WIDTH, HEIGHT, MAX and DIM will depend on your source file (effect.jpg). I used the left-hand square of the image you supplied.Code: Select all
D:\web\im> FOR /F "usebackq" %L IN (`identify -format "WIDTH=%w\nHEIGHT=%h" e.jpg`) DO set %L D:\web\im>set WIDTH=334 D:\web\im>set HEIGHT=334 D:\web\im> FOR /F %i IN ('identify -ping -format "%[fx:max(%WIDTH%,%HEIGHT%)]" xc:') DO set MAX=%i D:\web\im>set MAX=334 D:\web\im> FOR /F %i IN ('identify -ping -format "%[fx:int(%MAX%*sqrt(2)+0.5)]" xc:') DO set DIM=%i D:\web\im>set DIM=472 D:\web\im> convert -size %DIM%x%DIM% radial-gradient: -gravity Center -crop%MAX%x%MAX%+0+0 +repage -resize "%WIDTH%x%HEIGHT%^!" vig_mask.png
You are, I hope, getting values for WIDTH etc? If not, did you run the first command I put on this thread?
Code: Select all
"%IM%convert" ^
e.jpg ^
( -clone 0 -modulate 100,0,100 ) ^
( -size %DIM%x%DIM% ^
radial-gradient: ^
-gravity Center -crop %MAX%x%MAX%+0+0 +repage ^
-resize "%WIDTH%x%HEIGHT%^!" -negate -write mpr:VIG_MASK -level 50%%,95%% ^
) ^
-composite ^
( -clone 0 -modulate 90,100,100 ) ^
( mpr:VIG_MASK -level 60%%,100%% ) ^
-composite ^
e3.png
Code: Select all
convert e.jpg ( -clone 0 -modulate 100,0,100 ) ( -size %DIM%x%DIM% radial-gradient: -gravity Center -crop %MAX%x%MAX%+0+0 +repage -resize "%WIDTH%x%HEIGHT%^!" -negate -write mpr:VIG_MASK -level 50%,95% ) -composite ( -clone 0 -modulate 90,100,100 ) ( mpr:VIG_MASK -level 60%,100% ) -composite e3.png
Code: Select all
convert car.jpg \
\( +clone -level 10x100% \) \
\( -clone 0 -fill black -colorize 100 -fill white -draw "circle 160,160 320,160" -blur 0x50 \) \
\( -clone 2 -negate -clone 1 -clone 0 -reverse -compose over -composite \) -delete 0,1 \
\( +clone -level 0x90% \) \
\( -clone 1 -clone 2 -clone 0 -compose over -composite \) -delete 1,2 \
\( +clone -colorspace sRGB -intensity rec709luminance -colorspace gray -set colorspace RGB -colorspace sRGB \
+level-colors "#3a0a59","#fea957" -level 5x85% -alpha set -channel a -evaluate set 70% +channel \) \
\( -clone 1 -clone 2 -clone 0 -compose over -composite \) -delete 0,1,2 \
\( +clone -fill "#1b1b1b" -colorize 100 -alpha set -channel a -evaluate set 70% +channel +clone +swap \
-compose screen -composite \) \
\( +clone -fill "#d29901" -colorize 100 -alpha set -channel a -evaluate set 50% +channel +clone +swap \
-compose colordodge -composite \) \
\( -clone 0 -fill black -colorize 100 -fill white -draw "circle 160,160 290,160" -blur 0x50 \) \
-delete 0 -alpha off -compose over -composite car_toaster.jpg
Code: Select all
convert car.jpg ^
( +clone -level 10x100%% ) ^
( -clone 0 -fill black -colorize 100 -fill white -draw "circle 160,160 320,160" -blur 0x50 ) ^
( -clone 2 -negate -clone 1 -clone 0 -reverse -compose over -composite ) -delete 0,1 ^
( +clone -level 0x90%% ) ^
( -clone 1 -clone 2 -clone 0 -compose over -composite ) -delete 1,2 ^
( +clone -colorspace sRGB -intensity rec709luminance -colorspace gray -set colorspace RGB -colorspace sRGB ^
+level-colors "#3a0a59","#fea957" -level 5x85%% -alpha set -channel a -evaluate set 70%% +channel ) ^
( -clone 1 -clone 2 -clone 0 -compose over -composite ) -delete 0,1,2 ^
( +clone -fill "#1b1b1b" -colorize 100 -alpha set -channel a -evaluate set 70%% +channel +clone +swap ^
-compose screen -composite ) ^
( +clone -fill "#d29901" -colorize 100 -alpha set -channel a -evaluate set 50%% +channel +clone +swap ^
-compose colordodge -composite ) ^
( -clone 0 -fill black -colorize 100 -fill white -draw "circle 160,160 290,160" -blur 0x50 ) ^
-delete 0 -alpha off -compose over -composite car_toaster.jpg
Thanks. It did take a few hours to get it all working correctly. The tutorial was a little obscure for those not fully familiar with PS.snibgo wrote:That's a heroic effort, fmw. The Windows version looks and works fine.
e.jpgsnibgo wrote:Pasting your command into a command window works for me.
What values do you have for WIDTH, HEIGHT, DIM and MAX? Please post e.jpg and e3.png. (Put them somewhere like dropbox.com and paste the URLs here.)