Create gradient and compose with image in one command

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
stefda@gmail.com
Posts: 2
Joined: 2018-12-25T15:09:07-07:00
Authentication code: 1152

Create gradient and compose with image in one command

Post by stefda@gmail.com »

I can't figure out if it is possible to create a new image with gradient and compose it with an existing image in one command. Please help.

Command to generate the gradient:

Code: Select all

convert -size 1200x747 gradient: gradient.jpg
Command to compose the gradient with an existing `input.jpg`:

Code: Select all

convert input.jpg gradient.png -compose linear_burn -composite output.jpg
Ideally, I'd like to get output.jpg in "one step", using the convert command, without having to generate and store the gradient.jpg image beforehand.
stefda@gmail.com
Posts: 2
Joined: 2018-12-25T15:09:07-07:00
Authentication code: 1152

Re: Create gradient and compose with image in one command

Post by stefda@gmail.com »

A few more searches and I finally understand the anatomy of the command line! What I'm after above can be achieved with this simple command:

Code: Select all

convert input.jpg -size 1200x747 gradient: -compose linear_burn -composite output.jpg
🤦‍♂️
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Create gradient and compose with image in one command

Post by fmw42 »

why linear burn and not just -compose over?
Post Reply