Using a tilt shift effect that turns out to be very slow

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

Using a tilt shift effect that turns out to be very slow

Post by lovelf »

Code: Select all

convert ( image -gamma 0.75 -modulate 100,130 -contrast ) 
        ( +clone -sparse-color Barycentric '0,0 black 0,%h white' -function polynomial 4,-4,1 -level 0,50% ) 
        -compose blur -set option:compose:args 5 -composite 
        image
It is slooow, what is making it so slow, is it the function polynomial, how can I speed it up or achieve a similar tilt shift effect that is not so slow / resource consuming.

Thank you
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Using a tilt shift effect that turns out to be very slow

Post by snibgo »

The slowness is probably in the compose blur. This is potentially very useful, but I find it far too slow for real-world images. (My record so far is five days to process an image!)

Instead, I make two or more images at different conventional blurs, and blend them as required.
snibgo's IM pages: im.snibgo.com
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Using a tilt shift effect that turns out to be very slow

Post by anthony »

I am not certain why it is so slow you must be using some very very large blur sigmas. However two variable blurs (one using just height, the other using just width) should be a lot faster. It is actually how 'blur' works, as opposed to 'gaussian blur'
See http://www.imagemagick.org/Usage/convol ... an_vs_blur

Fred also has a script that merges multiple (16 or so) blurs of an image, to generate a variable blur. It was written before variable blur became available.
http://www.fmwconcepts.com/imagemagick/ ... /index.php
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Using a tilt shift effect that turns out to be very slow

Post by fmw42 »

I just uploaded a new unix bash script, tiltshift, to my web site. It uses a mask to generate a varying blur and to keep the center unblurred. It does not use -compose blur, but a simple -blur and composites the original and blurred image using a gradient mask. See the link below. I have no idea if it will be faster or slower than Anthony's method using -compose blur.
Post Reply