Implement This Filter
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Implement This Filter
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".
snibgo's IM pages: im.snibgo.com
-
- Posts: 16
- Joined: 2013-11-02T06:35:23-07:00
- Authentication code: 6789
Re: Implement This Filter
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".
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Implement This Filter
Huh? You really want to type them at the command prompt? Just type them, but change every "%%" to "%". Good luck with that.
snibgo's IM pages: im.snibgo.com
-
- Posts: 16
- Joined: 2013-11-02T06:35:23-07:00
- Authentication code: 6789
Re: Implement This Filter
As a matter of fact, I did try it, but its not working..
Its giving me errors as shown below.
What am I doing wrong ?
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
What am I doing wrong ?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Implement This Filter
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.
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
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?
snibgo's IM pages: im.snibgo.com
-
- Posts: 16
- Joined: 2013-11-02T06:35:23-07:00
- Authentication code: 6789
Re: Implement This Filter
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?
-
- Posts: 16
- Joined: 2013-11-02T06:35:23-07:00
- Authentication code: 6789
Re: Implement This Filter
I dont know what happened, but its working now. I can generate the vignette mask. Thanks!
Is there a way to use this vignette mask in the original image without having to save it to vig_mask.png ?
Is there a way to use this vignette mask in the original image without having to save it to vig_mask.png ?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Implement This Filter
Yes. The two convert commands can be combined:
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
snibgo's IM pages: im.snibgo.com
-
- Posts: 16
- Joined: 2013-11-02T06:35:23-07:00
- Authentication code: 6789
Re: Implement This Filter
I just tried this code, and I'm getting the original image as the output (without any vignette or any modifications)
The entire command is written in a single line. I'm not getting any errors either. Just that no effect is being applied.
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
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Implement This Filter
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.)
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.)
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Implement This Filter
Here is my conversion of the PS tutorial into IM commands. Note this is limited to a square image of the size of the car image. For other square sizes, the circle arguments must be modified accordingly. For non-square image, replace the circle with an ellipse.
Unix
Windows (please correct if in error)
I will build a script for this shortly.
Unix
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
I will build a script for this shortly.
Last edited by fmw42 on 2013-11-03T16:22:57-07:00, edited 1 time in total.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Implement This Filter
That's a heroic effort, fmw. The Windows version looks and works fine.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Implement This Filter
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.
-
- Posts: 16
- Joined: 2013-11-02T06:35:23-07:00
- Authentication code: 6789
Re: Implement This Filter
The windows versions does look good! Thanks!
So if I want to have this filter to be applied to various images of different sizes, how to go about it ?
So if I want to have this filter to be applied to various images of different sizes, how to go about it ?
-
- Posts: 16
- Joined: 2013-11-02T06:35:23-07:00
- Authentication code: 6789
Re: Implement This Filter
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.)
e3.jpg
Windows command