Page 1 of 3
Implement This Filter
Posted: 2013-11-02T06:39:11-07:00
by johnthomas1433
While browsing through the web, I came across this image, and I'm wondering whether it can be implemented through ImageMagick. The first image is the original image, and the second image is the filtered image.
Re: Implement This Filter
Posted: 2013-11-02T09:09:35-07:00
by glennrp
You can tinker with -sepia-tone and -gamma.
Code: Select all
convert photoshop*.jpg -sepia-tone 80% -gamma 1.2,.5,.8 ...
comes fairly close to your objective, but looks a little warmer. You also
seem to have a slight "fog" effect which I did not try to reproduce.
Re: Implement This Filter
Posted: 2013-11-02T09:19:27-07:00
by johnthomas1433
Thanks for your reply!
How to implement that fog effect ?
Re: Implement This Filter
Posted: 2013-11-02T09:57:10-07:00
by fmw42
You may be able to achieve the fog effect by adding some white to the image and then adding a vignette effect.
see -colorize and -vignette
Also please identify your version of IM and platform.
Re: Implement This Filter
Posted: 2013-11-02T11:15:49-07:00
by snibgo
If the OP provides the link to the original page, we might get a hint.
This is fairly close, but noticably wrong in the top-right highlights. Windows script:
Code: Select all
%IM%convert effect.jpg ^
-channel R -level -73.91%%,81.91%% ^
-channel G -level -4%%,96%% ^
-channel B -level -78.58%%,213.08%% ^
+channel ^
e.jpg
Re: Implement This Filter
Posted: 2013-11-02T12:28:26-07:00
by fmw42
It is like the Toaster Effect from Instagram. The following Photoshop tutorial explains how to create it.
http://www.photoshoproadmap.com/video/yt/PmWE-FZOgyU/
It was effect 31 at
http://designrfix.com/resources/33-amaz ... -tutorials
Re: Implement This Filter
Posted: 2013-11-02T13:59:01-07:00
by snibgo
The main fault with my attempt above is the lack of a vignette effect. I'll create a mask for a vignette. This is white in the centre, black in the corners, with equal values in the centre of each edge (thus has elliptical contours).
Code: Select all
FOR /F "usebackq" %%L IN (`%IM%identify -format "WIDTH=%%w\nHEIGHT=%%h" e.jpg`) DO set %%L
FOR /F %%i ^
IN ('%IM%identify ^
-ping ^
-format "%%[fx:max(%WIDTH%,%HEIGHT%)]" ^
xc:') ^
DO set MAX=%%i
FOR /F %%i ^
IN ('%IM%identify ^
-ping ^
-format "%%[fx:int(%MAX%*sqrt(2)+0.5)]" ^
xc:') ^
DO set DIM=%%i
"%IM%convert" ^
-size %DIM%x%DIM% ^
radial-gradient: ^
-gravity Center -crop %MAX%x%MAX%+0+0 +repage ^
-resize "%WIDTH%x%HEIGHT%^!" ^
vig_mask.png
Then I use this mask twice, to reduce saturation and then lightness in the corners. The two levels give different fades.
Code: Select all
"%IM%convert" ^
e.jpg ^
( -clone 0 -modulate 100,0,100 ) ^
( vig_mask.png -negate -level 50%%,95%% ) ^
-composite ^
( -clone 0 -modulate 90,100,100 ) ^
( vig_mask.png -negate -level 60%%,100%% ) ^
-composite ^
e2.png
I shouldn't use JPEG as an intermediate format, but it probably adds to the overall horrible degraded appearance.
Re: Implement This Filter
Posted: 2013-11-02T16:58:18-07:00
by johnthomas1433
fmw42 wrote:Also please identify your version of IM and platform.
My IM version is 6.8.7-0 and I'm running it on Windows (will the same code produce a different effect in Linux or other OS ?)
snibgo wrote:If the OP provides the link to the original page, we might get a hint.
I see that fmw42 has already posted the link. Thanks
Re: Implement This Filter
Posted: 2013-11-02T17:03:11-07:00
by fmw42
johnthomas1433 wrote:
My IM version is 6.8.7-0 and I'm running it on Windows (will the same code produce a different effect in Linux or other OS ?)
No, but almost. There are some syntax differences between IM on Windows and IM on Unix (Linux, Mac)
See
http://www.imagemagick.org/Usage/windows/
The code provided above by snibgo is for Windows.
Re: Implement This Filter
Posted: 2013-11-02T17:07:28-07:00
by johnthomas1433
johnthomas1433 wrote:fmw42 wrote:Also please identify your version of IM and platform.
My IM version is 6.8.7-0 and I'm running it on Windows (will the same code produce a different effect in Linux or other OS ?)
snibgo wrote:If the OP provides the link to the original page, we might get a hint.
I see that fmw42 has already posted the link. Thanks
snibgo wrote:This is fairly close, but noticably wrong in the top-right highlights. Windows script:
Code: Select all
%IM%convert effect.jpg ^
-channel R -level -73.91%%,81.91%% ^
-channel G -level -4%%,96%% ^
-channel B -level -78.58%%,213.08%% ^
+channel ^
e.jpg
That is pretty close! But like you have said, it does lack a vignette effect.
fmw42 wrote:No, but almost. There are some syntax differences between IM on Windows and IM on Unix (Linux, Mac)
See
http://www.imagemagick.org/Usage/windows/
The code provided above by snibgo is for Windows.
Thanks for the link! I'm using it now on Windows, but I may have to use it later on a Linux system.
Re: Implement This Filter
Posted: 2013-11-02T17:20:59-07:00
by johnthomas1433
snibgo wrote:I'll create a mask for a vignette. This is white in the centre, black in the corners, with equal values in the centre of each edge (thus has elliptical contours).
Code: Select all
FOR /F "usebackq" %%L IN (`%IM%identify -format "WIDTH=%%w\nHEIGHT=%%h" e.jpg`) DO set %%L
FOR /F %%i ^
IN ('%IM%identify ^
-ping ^
-format "%%[fx:max(%WIDTH%,%HEIGHT%)]" ^
xc:') ^
DO set MAX=%%i
FOR /F %%i ^
IN ('%IM%identify ^
-ping ^
-format "%%[fx:int(%MAX%*sqrt(2)+0.5)]" ^
xc:') ^
DO set DIM=%%i
"%IM%convert" ^
-size %DIM%x%DIM% ^
radial-gradient: ^
-gravity Center -crop %MAX%x%MAX%+0+0 +repage ^
-resize "%WIDTH%x%HEIGHT%^!" ^
vig_mask.png
Then I use this mask twice, to reduce saturation and then lightness in the corners. The two levels give different fades.
You have lost me here, as I'm a newbie to Imagemagick. Can you kindly explain how you implemented the vignette effect? Wont -vignette command work here ?
Re: Implement This Filter
Posted: 2013-11-02T17:38:50-07:00
by snibgo
The same IM commands should produce identical results on any platform. My commands above use Windows "FOR". Unix works differently.
If you run my commands and look at vig_mask.png, you should see it is as I described. My final convert does two operations:
1. Makes a copy of e.jpg with zero-saturation (ie monochrome), and compose it over e.jpg, but only at the edges.
2. Makes another copy of e.jpg, but slightly darker, and compose this over the previous result, but only at the edges.
You could do it with "-vignette" instead. My version gives greater control over the width and placement of the transition between the original and the two copies.
Re: Implement This Filter
Posted: 2013-11-02T17:57:33-07:00
by johnthomas1433
When I try the first line of your code in the command prompt
Code: Select all
FOR /F "usebackq" %%L IN (`%IM%identify -format "WIDTH=%%w\nHEIGHT=%%h" e.jpg`) DO set %%L
I'm getting the error as
What am I doing wrong ?
Re: Implement This Filter
Posted: 2013-11-02T18:08:11-07:00
by johnthomas1433
johnthomas1433 wrote:When I try the first line of your code in the command prompt
Code: Select all
FOR /F "usebackq" %%L IN (`%IM%identify -format "WIDTH=%%w\nHEIGHT=%%h" e.jpg`) DO set %%L
I'm getting the error as
What am I doing wrong ?
My bad. Didnt see it as a bash script
Re: Implement This Filter
Posted: 2013-11-02T18:08:55-07:00
by johnthomas1433
...