Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8192935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:18:20+00:00 2026-06-07T04:18:20+00:00

I have a command that I can run on the command line to tilt-shift

  • 0

I have a command that I can run on the command line to tilt-shift an image using Imagemagick:

convert \( myimage.jpg -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 myimage.jpg

I’d like to be able to reproduce the effect of this command using PHP’s imagemagick library. The first parts of the command are easy to reproduce, but I’m having trouble figuring out sparse-color and the arguments after it. So far I have:

$image = new imagick("myimage.jpg")
$image->gammaImage(0.75);
$image->modulateImage(100,130,100);
$image->contrastImage(1);

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:18:21+00:00Added an answer on June 7, 2026 at 4:18 am

    I am assuming that you are referring to the examples found here:

    http://www.imagemagick.org/Usage/photos/

    With that said, I have been trying to accomplish the very same thing with PHP Imagick. I am using PHP Imagick 3.0.1 and ImageMagick 6.7.4-4 2012-01-09 Q16 in Linux.

    It appears that the blur composite mode is undocumented. I found it by looking through the ImageMagick source under magick/composite.h on line 88.

    This code accomplishes what you are looking for:

    $im = new Imagick();
    $im->readImageBlob(file_get_contents($src));
    $qr = $im->getQuantumRange();
    $qr = $qr['quantumRangeLong'];
    $im->sigmoidalContrastImage(true, 10, $qr / 2, Imagick::CHANNEL_ALL);
    $blurmap = new Imagick();
    $blurmap->setOption('compose:args', '5');
    $blurmap->newPseudoImage($im->getImageWidth(), $im->getImageHeight(), 'gradient:black-white');
    $blurmap->functionImage(Imagick::FUNCTION_POLYNOMIAL, array(4.5, -4.5, 1));
    $blurmap->levelImage(0, 1, $qr / 2);
    $im->compositeImage($blurmap, 57, 0, 0);
    $blurmap->destroy();
    

    If you require more blur, simply change compose:args to 10 or something. One thing I figured out was that I had to set the option before I created/loaded anything into the wand itself.

    I could not get the SparseColorImage() function to behave as it does on the command line, although I am sure that someone else could contribute that part if they figure it out. The above is enough for my needs.

    EDIT: Upon further inspection of the images generated I noticed that even the black parts of the blur map were being blurred. After some searching it appears that this stems from a bug introduced in ImageMagick. I switched to version 6.7.8-1 2012-07-05 Q16 and the blur map now appears to be working. If you notice unwanted blurring with the blur composite I suggest you upgrade your ImageMagick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a tool that is run on the command line. I can
I have a shell script that I can run successfully from the command line.
I have a plain perl script that can be run from the command-line via
I have a Python3 script that can take optional command line parameters which the
I have MySQL running such that I can open a client command line and
I have a simple C++ program that I can compile (g++ from command line)
I have written a Windows application, that can take in some command line arguments
I would like a command line function that I can run on any file
Today, I have read that command's object in WPF can be serialized. And I'm
I have a command that I want to run on machine B from machine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.