Border, Frame, and the use of BorderColor

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
oleksiy
Posts: 12
Joined: 2014-11-22T16:53:32-07:00
Authentication code: 6789

Border, Frame, and the use of BorderColor

Post by oleksiy »

According to the IM documentation http://www.imagemagick.org/Usage/crop/#border and http://www.imagemagick.org/Usage/misc/#border the "-border" option has an intended side effect
that "-border" creates a new image of the right size, then overlays the original source image over this new backgroun
and it definitely was working in some previous versions of IM however this is not the case now at least in 6.9.7-0 or 6.9.2-10 which I tried. The following examples from documentation are not working as documented:

Code: Select all

convert star.gif -bordercolor LimeGreen -border 0  star_background.gif
It should change the background of the star.gif to LimeGreen however nothing happens (the background is not changed).

The following example is said to
For example, under IM this sets the transparent areas of the star image to the "-bordercolor" and completely ignores the "-background" color setting.

Code: Select all

convert star.gif -bordercolor LimeGreen   -background Gold -border 10       star_border.gif
But now it just adds a green border 10px width.

Is this new behaviour correct? Thanks!
oleksiy
Posts: 12
Joined: 2014-11-22T16:53:32-07:00
Authentication code: 6789

Re: Border, Frame, and the use of BorderColor

Post by oleksiy »

This also happens in 7.0.4-7
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Border, Frame, and the use of BorderColor

Post by snibgo »

The behaviour of "-border" has changed so it no longer complies with the documentation. See for example viewtopic.php?f=3&t=27997&p=123648

The description at http://www.imagemagick.org/script/comma ... php#border is currently wrong. I don't know what it should be. Or whether the behaviour will revert to what it used to be.

EDIT: See also viewtopic.php?f=3&t=30045&p=135353 . It seems the "bug" reported there, which wasn't a bug but the documented behaviour, has been "fixed".
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Border, Frame, and the use of BorderColor

Post by fmw42 »

The basic concept of -border is to add a border around the outside of an opaque image. The secondary use for transparent images to fill the background is a special case and does not seem to work. I do not know if this is a bug or not. But you have several other methods to fill the background such as

Code: Select all

convert star.gif -background limegreen -flatten star_background.gif
or

Code: Select all

convert star.gif -background limegreen -alpha background -alpha off star_background.gif
oleksiy
Posts: 12
Joined: 2014-11-22T16:53:32-07:00
Authentication code: 6789

Re: Border, Frame, and the use of BorderColor

Post by oleksiy »

Thanks!
Post Reply