-shadow like photoshop inner-shadow on rounded rectangle

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?".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -shadow like photoshop inner-shadow on rounded rectangle

Post by fmw42 »

Shadow only works on the image alpha shape. As such if you negate alpha, you can generate a shadow for the inside
of the image.
Thanks. I was actually going to give that a try earlier, but then saw his PS examples and figured he wanted something else.
hsynucak
Posts: 1
Joined: 2015-12-25T20:41:13-07:00
Authentication code: 1151

Re: -shadow like photoshop inner-shadow on rounded rectangle

Post by hsynucak »

hi;
how can ı php functions on to create inner shadow image. please sample code. sample image : https://cdn.pluscanvas.com/d/0-0-1-6358 ... d-tree.jpg
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: -shadow like photoshop inner-shadow on rounded rectangle

Post by Bonzo »

That looks like a normal shadow to me.

Crop your image
Create your canvas effect on each new image
Add a drop shadow to each of the new images
Arrange the new images with the drop shadow on a canvas

If you want somebody to write the whole code to create the complete effect on the attached image you will probably be out of luck as it is quite complicated.
If that is the case I suggest you have a go and do what you can and then come back with any questions.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -shadow like photoshop inner-shadow on rounded rectangle

Post by fmw42 »

Looks to me like two different outer shadows. Plus a gradient background. Plus a gradient shading on the 4 images.

Can you provide the input image(s)? You can post to some free hosting service such as dropbox.com and put the URLs here.

Also always identify your version of Imagemagick and platform, since syntax differs.
shoansa
Posts: 15
Joined: 2017-07-18T00:12:17-07:00
Authentication code: 1151

Re: -shadow like photoshop inner-shadow on rounded rectangle

Post by shoansa »

Hi everyone,

I have same above problem with image. I have to apply Inner Shadow on image from all sides same like Photoshop. Till now to I have done as in my below URL

Image with Blur:
https://stagedesignerimages.artifi.net/ ... 1465b2.png

but the problem is Blur is applying on whole image instead of applying only on Inner shadow.
Used image:

https://stagedesignerimages.artifi.net/ ... dad1b5.png

IM command:

convert input.png ( -clone 0 -alpha extract ) ( -clone 0 -bordercolor none -border 9 -channel rgba -blur 6x6 -shave 9x9 ) -delete 0 +swap -alpha off -compose copy_opacity -composite output.png

Please suggest and provide sample command.

Thanks in advance.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -shadow like photoshop inner-shadow on rounded rectangle

Post by fmw42 »

Please identify your IM version. Also please show your Photoshop result.
shoansa
Posts: 15
Joined: 2017-07-18T00:12:17-07:00
Authentication code: 1151

Re: -shadow like photoshop inner-shadow on rounded rectangle

Post by shoansa »

Hi,

IM version is "ImageMagick-6.9.1-Q16-HDRI"

Photoshop result with applied inner shadow values in Photoshop.

https://stagedesignerimages.artifi.net/ ... 29f559.jpg

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

Re: -shadow like photoshop inner-shadow on rounded rectangle

Post by fmw42 »

This should do it. Adjust the 25% to a larger value if you want the shadow darker.

input:
Image

Code: Select all

convert penguin.png \
\( -clone 0 -alpha extract \) \
\( -clone 1 -blur 0x10 -level 25x100% \) \
+swap -compose multiply -composite \
penguin_shadow.png
Image
shoansa
Posts: 15
Joined: 2017-07-18T00:12:17-07:00
Authentication code: 1151

Re: -shadow like photoshop inner-shadow on rounded rectangle

Post by shoansa »

Thank You Fred its working fine now, this is what I needed.

Thanks a lot
Post Reply