How to do only northeast border?

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
TualatriX

How to do only northeast border?

Post by TualatriX »

Hello all,

I want to write a drop shadow script, now I've drop the shadow successful.

Use the following command(it isn't written by me, I checkout from gscrot).

Code: Select all

convert "${FILE}" \( +clone -background gray -shadow 80x3+5+5 \) \
+swap -background none -mosaic +repage "${FILE}"
The question is, I want to do a alpha border in the northest, this command will apply the alpha border in all sides, but I only want to apply at northeast.

Code: Select all

convert -bordercolor 'rgba(255,255,255,0)' -border 10x10 test.png test_out.png
So how can I do it?
TualatriX

Re: How to do only northeast border?

Post by TualatriX »

Oh, I got it:

Code: Select all

convert test.png -gravity northwest -background 'rgba(255,255,255,0)' -splice 20x20  test_out.png
:D
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to do only northeast border?

Post by anthony »

The PROPER solution is to NOT use -mosaic which only extends the virtual canvas right and downward, but clips images in the other direction.

Use instead -layers merge and follow with +repage to remove the image offset.

See IM examples, Shadow...
http://www.imagemagick.org/Usage/convolve/#shadow

which uses this technique, and goes to explain what is going one, as well as alternative solutions, such as what you discovered.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply