rize and add radial-gradient background

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
ptuaillon
Posts: 4
Joined: 2019-08-26T08:54:32-07:00
Authentication code: 1152

rize and add radial-gradient background

Post by ptuaillon »

HI, everyone.

I'm new to imageMagick.

I have a 500x500 png image.

I made a mirror effect that fades away like this : https://www.imagemagick.org/discourse-s ... hp?t=15371

My source code :

Code: Select all

#{sourceFilePath}
( -size 500x0 xc:none )
( -clone 0 -flip -crop 500x150+0+0 +repage 
        -size 500x150 gradient: +level 0x50%
        -compose copy_opacity -composite )

	-channel rgba -alpha on -append 
#{targetFilePath} 
i must resize my picture with heigth 118.
And I must add a radial-gradient in background but with size in 200x118

Can you help me pls ?

thanks :D
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: rize and add radial-gradient background

Post by fmw42 »

You should not use a size with height = 0 (-size 500x0). That is not good. Is that a typo mistake?

What is your ImageMagick version and platform? Please always provide that as syntax may vary. I assume from your command, though not properly printed, is Windows.

I do not understand the question? Please post an example input and output of what you want. Where do you want the radial gradient.

Radial gradients are generated by radial-gradient: in place of gradient:. See https://imagemagick.org/Usage/canvas/#radial-gradient

You can resize your input using -resize 118x118. See https://imagemagick.org/script/command- ... php#resize


Perhaps this is what you want?

Input:
Image

Code: Select all

convert zelda3.png -resize 118x118 ^
( -clone 0 -flip -size 118x118 radial-gradient:  ^
-alpha off -compose copy_opacity -composite ) ^
-smush +20 zelda3_mirror.png
Image
ptuaillon
Posts: 4
Joined: 2019-08-26T08:54:32-07:00
Authentication code: 1152

Re: rize and add radial-gradient background

Post by ptuaillon »

Hi fmw42,
Thanks for your reply


You should not use a size with height = 0 (-size 500x0). That is not good. Is that a typo mistake?

In this example : https://www.imagemagick.org/discourse-s ... hp?t=15371

0 = spacer Or I don't want space between the picture and this flip.

My original picture in 500 x500 :

Image

this derivate :

Image

I use imageMagick through Nuxeo. I think i use the last version of ImageMagick.

My system :

Code: Select all

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.6 LTS
Release:	16.04
Codename:	xenial
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: rize and add radial-gradient background

Post by fmw42 »

Your command as written does not produce your output given the input you provided. So I am not sure what you are trying to do with that command.

You have not provided the version of ImageMagick, only the version of your OS Ubuntu.

If you do not want any space between two images, just use -append. There is no need for a zero sized spacer.

From my command above replace -smush 20 with -append, if you do not want any space between the two images and you want a radial gradient.

Code: Select all

convert zelda3.png -resize 118x118 ^
( -clone 0 -flip -size 118x118 radial-gradient:  ^
-alpha off -compose copy_opacity -composite ) ^
-append zelda3_mirror.png
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: rize and add radial-gradient background

Post by fmw42 »

I am not sure if I understand, but here is what I think you might want. If I assume you want the output to be 200x118. Then I resize your image to 84x84. Pad to 200x84. Then create the linear gradient mirror effect with a 200x34 bottom part. Append the two. Then composite that over a radial gradient.

If this is not what you want, then please be more specific or show an example of the result you want.

Input:
Image

Code: Select all

convert img.png -resize 84x84 ^
-gravity north -background none -extent 200x84 ^
( -clone 0 -flip ^
( -size 200x84 gradient: -negate ) ^
-alpha off -compose copy_opacity -composite ^
-gravity north -crop 200x34+0+0 +repage ) ^
-append ^
( -size 200x118 radial-gradient: ) ^
+swap -compose over -composite ^
img_result.png
Image
ptuaillon
Posts: 4
Joined: 2019-08-26T08:54:32-07:00
Authentication code: 1152

Re: rize and add radial-gradient background

Post by ptuaillon »

That's exactly what I wanted.

Just one last question.

When i change radial-gradient: by radial-gradient:white-LightGray i have a linear gradient.
But if I change by radial-gradient:red-blue i have a radial-gradient

Can you help me ?

My imagemagick version is : ImageMagick-7.0.8-62

thanks for all !!!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: rize and add radial-gradient background

Post by fmw42 »

try

radial-gradient:LightGray-white

the first argument in your command, whichwas white, will replace black, so you would be getting a white and light gray gradient. It is still radial, but may not look very much so.
ptuaillon
Posts: 4
Joined: 2019-08-26T08:54:32-07:00
Authentication code: 1152

Re: rize and add radial-gradient background

Post by ptuaillon »

Thanks for your reply

it's solved ! :)
Post Reply