How to do this in ImageMagick, light tutorial on PhotoShop

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
lovelf
Posts: 13
Joined: 2012-12-11T13:23:57-07:00
Authentication code: 6789

How to do this in ImageMagick, light tutorial on PhotoShop

Post by lovelf »

How to accomplish the X PRO II filter effect of Instagram but with ImageMagick command line instead of PhotoShop

Link to Photoshop tutorial:
http://iamiqbal87.blogspot.com/2012/04/ ... ffect.html
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to do this in ImageMagick, light tutorial on PhotoSh

Post by fmw42 »

1) for the vignette image, draw an ellipse rotated to the size and orientation of the diagonal of the image with fill white on black background (or the opposite) and then blur it appropriately. You will have to look carefully at the ellipse in PS and try to match its major and minor radii and blur.

2) create a hald:8 image in IM and take it to photoshop and open it and apply the same curve settings to it. You can save the settings for any curve and open it for the hald image. Then apply the curve settings to the hald image and save it. Bring it back to IM where you can apply it to your background image using -hald-clut

3) composite the vignette image on the adjusted image

4) add a black border using -border or -shave first and then -border depending upon whether you want the image size to change
lovelf
Posts: 13
Joined: 2012-12-11T13:23:57-07:00
Authentication code: 6789

Re: How to do this in ImageMagick, light tutorial on PhotoSh

Post by lovelf »

You are a real genius on this from what I've seen on Fred's ImageMagick Scripts, is it too much to ask you for the command line syntax to achieve these simple steps. With ImageMagick some things are still chinese to me.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to do this in ImageMagick, light tutorial on PhotoSh

Post by fmw42 »

lovelf wrote:You are a real genius on this from what I've seen on Fred's ImageMagick Scripts, is it too much to ask you for the command line syntax to achieve these simple steps. With ImageMagick some things are still chinese to me.

It would take me quite some time (hours) to do that as I need to figure out how to match PS ellipse and blurring to get the vignette effect close in IM and also to try to match the curves function.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to do this in ImageMagick, light tutorial on PhotoSh

Post by fmw42 »

fmw42 wrote:
lovelf wrote:You are a real genius on this from what I've seen on Fred's ImageMagick Scripts, is it too much to ask you for the command line syntax to achieve these simple steps. With ImageMagick some things are still chinese to me.

It would take me quite some time (hours) to do that as I need to figure out how to match PS ellipse and blurring to get the vignette effect close in IM and also to try to match the curves function.
I can try to work on this, but I have to finish some other projects first. So I cannot say exactly when I will have it done. Perhaps within a week.

It would be a unix shell script. So if you are on Windows, you or someone else would have to translate the commands to Windows syntax or Bat file or use Cygwin.

What platform are you on and what version of IM are you using?
lovelf
Posts: 13
Joined: 2012-12-11T13:23:57-07:00
Authentication code: 6789

Re: How to do this in ImageMagick, light tutorial on PhotoSh

Post by lovelf »

I have this PHP code which I am unsure if it does the right vignette fine.

Code: Select all

function vignette($input, $color_1 = 'none', $color_2 = 'black', $crop_factor = 1.5)
    {
        $img_resource_size=getimagesize($input);
        $img_resource_width=$img_resource_size[0];

        $img_resource_height=$img_resource_size[1];

        $crop_x = floor($img_resource_width * $crop_factor);
        $crop_y = floor($img_resource_height * $crop_factor);
        
        $command=("convert 
        ( {$input} ) 
        ( -size {$crop_x}x{$crop_y} 
        radial-gradient:$color_1-$color_2 
        -gravity center -crop {$this->_width}x{$this->_height}+0+0 +repage )
        -compose multiply -flatten 
        {$input}");   

        $command = str_replace(array("\n", "'"), array('', '"'), $command);
        # replace multiple spaces with one
        $command = preg_replace('#(\s){2,}#is', ' ', $command);
        # escape shell metacharacters
        $command = escapeshellcmd($command);
        # execute convert program
        exec($command);
    }
It is used

Code: Select all

vignette(img_resource, 'none');
I gathered a php class from
http://net.tutsplus.com/tutorials/php/c ... -with-php/

Which has some of the Instagram filters available, but not the most popular, like this one X Pro II.

I am doing a website that is a social network in which I plan on incorporating the options to apply filters to photos.
So far I have 6 filters working in PHP.

Gotham
Toaster
Nashville
Lomo-fi
LordKelvin
Tilt Shift

7 more filters for which I have the ps actions file.

Brannan
Earlybird
Hefe
Inkwell
Sutro
Walden
X Pro II

Out of 21 total filters to my knowledge - I do not have an iPhone or smart phone but looks as it is the complete list of filters right now for Instagram - I am missing any kind of direction/source to create the following 8 filters:

Rise
Valencia
Amaro
Hudson
Lo-fi
Sierra
1977
Willow

Also there are adobe lightroom presets very cheap for purchase which I do not know if these would contribute in something for the missing 8 above or for a better understanding compared to the ps actions which seem need some editing as marked with an asterisk on the action names for some of the filters:

http://reallyniceimages.com/?p=21
http://reallyniceimages.com/wp-content/ ... edding.jpg
Except for Lomo-fi, Gotham and Tilt Shift - which I already have as PHP - the package contains all presets for all the rest of the filters, only those three and Willow are missing.

Willow can be purchased separately as well:
http://reallyniceimages.com/?p=799

-If those presets could be of any help I'd just buy them.

I want to take to PHP the imagemagick exec commands to do the 7 filters for which I have the ps action file and later the 8 missing filters. Only problem is I do not have resources in the moment to hire someone for the work and it doesn't look right now I might be able to accomplish it myself without lots of time.

I also checked your website for some filters which I would likely implement such as "cartoons", "sketch" and "wooden" - directing first to you for commercial approval.
Last edited by lovelf on 2012-12-12T12:47:24-07:00, edited 1 time in total.
lovelf
Posts: 13
Joined: 2012-12-11T13:23:57-07:00
Authentication code: 6789

Re: How to do this in ImageMagick, light tutorial on PhotoSh

Post by lovelf »

I have time to wait, I am on Windows and ImageMagick-6.8.0-8-Q16 but could test on a virtual machine Linux and the final version in the server will be Linux, can try to implement with cygwin for localhost as it is on what I'm developing. But will definitely make the necessary tests on Linux. If you could do a few more after that one with months available for completion (planing to present the website in August/October 2013 and I can do all that is necessary for lesser filters before having all of the filters available), and the company really becomes successful [it is a very good merge between Facebook, Pinterest and now - Instagram] I will contact you.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to do this in ImageMagick, light tutorial on PhotoSh

Post by fmw42 »

Please contact me offline at fmw at alink dot net
lovelf
Posts: 13
Joined: 2012-12-11T13:23:57-07:00
Authentication code: 6789

Re: How to do this in ImageMagick, light tutorial on PhotoSh

Post by lovelf »

Sent you a message as collapablo at gmail dot com
Post Reply