How to build this effect in Image Magick?
How to build this effect in Image Magick?
Hi,
can someone please tell me how can I create this effect in imageMagick?
2 images, one as overlay with a gradient in the middle over the first image.
Thank you in advance.
Pim.
can someone please tell me how can I create this effect in imageMagick?
2 images, one as overlay with a gradient in the middle over the first image.
Thank you in advance.
Pim.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to build this effect in Image Magick?
Unix syntax:
See
https://imagemagick.org/Usage/canvas/#t ... _gradients
https://imagemagick.org/Usage/compose/#compose
________
Please, always provide your IM version and platform when asking questions, since syntax may differ.
Also provide your exact command line and your images, if possible.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620
If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli
For novices, see
http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
Code: Select all
convert image1 image2 \( -clone 1 -channel rgba -alpha transparent -sparse-color barycentric '0,0 white %w,0 black' \) -compose over -composite result
https://imagemagick.org/Usage/canvas/#t ... _gradients
https://imagemagick.org/Usage/compose/#compose
________
Please, always provide your IM version and platform when asking questions, since syntax may differ.
Also provide your exact command line and your images, if possible.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620
If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli
For novices, see
http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
Re: How to build this effect in Image Magick?
Thank you @fmw42 for your reply and your explications, wow I would like to have your IM skills
I am on IM7 on OSx:
convert --version
Version: ImageMagick 7.0.8-11 Q16 x86_64 2018-09-08 https://www.imagemagick.org
The command that you gave me does not work, I suppose it's related to IM7?
I tried with:
In the result.jpg I only see 2.jpg ass output.
I am on IM7 on OSx:
convert --version
Version: ImageMagick 7.0.8-11 Q16 x86_64 2018-09-08 https://www.imagemagick.org
The command that you gave me does not work, I suppose it's related to IM7?
I tried with:
Code: Select all
convert 1.jpg 2.jpg \( -clone 1 -channel rgba -alpha transparent -sparse-color barycentric '0,0 white %w,0 black' \) -compose over -composite result.jpg
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: How to build this effect in Image Magick?
If you're using IM7 you should be using the command "magick" instead of "convert".pimboli wrote: ↑2018-10-05T04:49:10-07:00I am on IM7 on OSx:
convert --version
Version: ImageMagick 7.0.8-11 Q16 x86_64 2018-09-08 https://www.imagemagick.org
The command that you gave me does not work, I suppose it's related to IM7?
This command is nearly the same as fmw42's, and it works for me using "convert" with IM 6.8.9-9 in a bash shell. Also, by eliminating the backslashes "\" it works with IM 6.9.10-11 in Windows, and by using "magick" with IM 7.0.8-12 in Windows...
Code: Select all
magick in1.jpg in2.jpg ( -clone 0 -sparse-color barycentric "0,0 black %[w],0 white" ) -composite out.jpg
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to build this effect in Image Magick?
Yes, I believe Windows requires double quotes and as Geemack said remove the \s from my command and for IM 7 use magick not convert.
Re: How to build this effect in Image Magick?
Thanks guys I really appreciate your help!
I have no success..
still gets me as result the 2.jpg
I even tried with magick instead of convert due to the facts that I am on IM7.
I think I need to \ the "(" on mac (its a bash shell).
If I run command without / I get an error:
https://imgur.com/a/8Y2mIsU
As you can see result.jpg = 2.jpg but not the required effect.
I have no success..
Code: Select all
magick 1.jpg 2.jpg \( -clone 1 -channel rgba -alpha transparent -sparse-color barycentric '0,0 white %w,0 black' \) -compose over -composite result.jpg
I even tried with magick instead of convert due to the facts that I am on IM7.
I think I need to \ the "(" on mac (its a bash shell).
If I run command without / I get an error:
Here are the input images and the result.jpg:bash-3.2$ magick 1.jpg 2.jpg ( -clone 1 -channel rgba -alpha transparent -sparse-color barycentric '0,0 white %w,0 black' ) -compose over -composite result.jpg
bash: syntax error near unexpected token `('
https://imgur.com/a/8Y2mIsU
As you can see result.jpg = 2.jpg but not the required effect.
Re: How to build this effect in Image Magick?
I tried now on a linux vps with IM 6,
and there it seems to work with convert instead of magick.
https://imgur.com/a/8Y2mIsU => look at result_linux.jpg.
In worst-case I could let run the script later under linux.
Could please tell me if you know how I could make the beginning and the end of the image "un-transparent" and only the middle part transparent gradient.
How I would like to have the image:
my result under linux:
Thanks!
and there it seems to work with convert instead of magick.
https://imgur.com/a/8Y2mIsU => look at result_linux.jpg.
In worst-case I could let run the script later under linux.
Could please tell me if you know how I could make the beginning and the end of the image "un-transparent" and only the middle part transparent gradient.
How I would like to have the image:
my result under linux:
Thanks!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to build this effect in Image Magick?
How much of the ends and middle? 1/3, 1/3, 1/3? or some other portions?Could please tell me if you know how I could make the beginning and the end of the image "un-transparent" and only the middle part transparent gradient.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to build this effect in Image Magick?
See also this recent thread: https://www.imagemagick.org/discourse-s ... =1&t=34789
snibgo's IM pages: im.snibgo.com
Re: How to build this effect in Image Magick?
Yes 1/3, 1/3 , 1/3 would be good I think so.
If you could give me the command I can adapt it in case I would like to change the proportions.
Many thanks!
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: How to build this effect in Image Magick?
In the example commands above there's a section inside parentheses. That's where you're creating the mask for the gradient overlay. You can use FX expressions in that "-sparse-color" operation to make the black and white start and end wherever you like. Here's a way to make that mask for a 1/3 solid first image, 1/3 fade to second image, and end with a 1/3 solid second image...
Code: Select all
... \( -clone 0 -sparse-color barycentric "%[fx:w*0.333],0 black %[fx:w*0.667],0 white" \) ...