Page 1 of 1

How to make an image transparent with gradient effect?

Posted: 2014-04-02T03:05:31-07:00
by bil80
I am not an expert in ImageMagick, and i want to make an image transparent with gradient effect as on Photoshop:

Image
Transparency effect with Photoshop:
Image

Re: How to make an image transparent with gradient effect?

Posted: 2014-04-02T03:37:21-07:00
by snibgo
Windows BAT syntax:

Code: Select all

convert ^
  clooney.jpg ^
  ( +clone ^
    -sparse-color barycentric "0,0,white %%[fx:w-1],0,white 0,%%[fx:h-1],black %%[fx:w-1],%%[fx:h-1],black" ^
  ) ^
  -compose CopyOpacity -composite ^
  c.png

Re: How to make an image transparent with gradient effect?

Posted: 2014-04-02T07:39:32-07:00
by bil80
Yes thanks a lot !

Re: How to make an image transparent with gradient effect?

Posted: 2014-04-02T18:25:57-07:00
by snibgo
My solution was over-complex. I had forgotten that barycentric can work with just two coordinates:

Code: Select all

convert ^
  clooney.jpg ^
  ( +clone ^
    -sparse-color barycentric "0,0,white 0,%%[fx:h-1],black" ^
  ) ^
  -compose CopyOpacity -composite ^
  c.png