Creating a box with inner shadow and image

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
mrblackman
Posts: 6
Joined: 2010-12-05T06:06:56-07:00
Authentication code: 8675308

Creating a box with inner shadow and image

Post by mrblackman »

Anyone have any idea if IM can be used to basically create this image from a simple square image (i.e. an instagram image):

http://cl.ly/2U1y1D2g101K3k1U462A

Its essentially a white border of around 15 around an image followed by another border with a neat inner shadow effect.

Thoughts?

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

Re: Creating a box with inner shadow and image

Post by fmw42 »

Something like this from my script imageborder, see link below:

Image

imageborder -s 5 -m black -p 75 -r white -t 15 -e edge -f inner zelda1.jpg zelda1_border.jpg


Image


The outer shading could be modified to make it softer.

See
http://www.imagemagick.org/Usage/crop/#border
http://www.imagemagick.org/Usage/thumbnails/#frame
http://www.imagemagick.org/Usage/thumbnails/#framing
http://www.imagemagick.org/Usage/blur/#blur

OR using the above commands:


convert \( zelda1.jpg -bordercolor white -border 15 \) \
\( -clone 0 -fill black -frame 5x5+0+5 \) \
+swap -gravity center -compose over -composite zelda1_border2.jpg

Image

OR with a softer bevel


convert \( zelda1.jpg -bordercolor white -border 15 \) \
\( -clone 0 -mattecolor black -frame 5x5+0+5 -blur 0x2 \) \
\( -clone 0 -shave 5x5 \) \
-delete 0 -gravity center -compose over -composite zelda1_border3.jpg


Image
mrblackman
Posts: 6
Joined: 2010-12-05T06:06:56-07:00
Authentication code: 8675308

Re: Creating a box with inner shadow and image

Post by mrblackman »

I don't know what's more amazing - ImageMagick or the support of this forum.

That worked great. One last thing - is it possible to either add a random patterned background/border or place the newly created image on top of a pattern that would fill the whole screen?

Right now my background looks like this:

ImageClick for large view - Uploaded with Skitch

and updates every 5 minutes from Instagram. Thats nice and all, but would be nicer if the blue (or whatever color) background had some texture to it.

Thanks again,

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

Re: Creating a box with inner shadow and image

Post by fmw42 »

try this, but adjust the 640x480 to your screen resolution


convert \( zelda1.jpg -bordercolor white -border 15 \) \
\( -clone 0 -mattecolor black -frame 5x5+0+5 -blur 0x2 \) \
\( -clone 0 -shave 5x5 \) \
-delete 0 -gravity center -compose over -composite \
\( -size 640x480 xc: +noise random \) \
+swap -gravity center -compose over -composite \
zelda1_border4.jpg

Image

or
convert \( zelda1.jpg -bordercolor white -border 15 \) \
\( -clone 0 -mattecolor black -frame 5x5+0+5 -blur 0x2 \) \
\( -clone 0 -shave 5x5 \) \
-delete 0 -gravity center -compose over -composite \
\( -size 640x480 plasma: \) \
+swap -gravity center -compose over -composite \
zelda1_border5.jpg

Image

see

http://www.imagemagick.org/Usage/canvas/#random
http://www.imagemagick.org/Usage/canvas ... _gradients

also see tiling from some small image for the background
http://www.imagemagick.org/Usage/canvas/#tile

Image

convert \( zelda1.jpg -bordercolor white -border 15 \) \
\( -clone 0 -mattecolor black -frame 5x5+0+5 -blur 0x2 \) \
\( -clone 0 -shave 5x5 \) \
-delete 0 -gravity center -compose over -composite \
\( -size 640x480 tile:tile_aqua.jpg \) \
+swap -gravity center -compose over -composite \
zelda1_border6.jpg

Image
mrblackman
Posts: 6
Joined: 2010-12-05T06:06:56-07:00
Authentication code: 8675308

Re: Creating a box with inner shadow and image

Post by mrblackman »

Once again, amazing. Its now selecting from a dir of different backgrounds. Thanks!

If you use Instagram and want the script, let me know.

-J


ImageClick for large view - Uploaded with Skitch
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Creating a box with inner shadow and image

Post by anthony »

You may also like to look though the various methods of adding 'fluff' to thumbnails...
http://www.imagemagick.org/Usage/thumbnails/#fluff
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply