I'd like to add a alpha-masked border around my images, but without cutting too much into the original content.
The idea is to inconspicuously extent the outer content of the image to an added border - basically what you would do in Photoshop with extent canvas and context-sensitive fill. Of course an automated IM result isn't to be as good, but as there is only some content visible through the border it doesn't need to be.
Any hints on how to add a border region around this image that is filled with some extension of the content - or is this beyond IM?
Content-aware image extent?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Content-aware image extent?
How big do you want the border?
This Windows BAT script gives a border of 4 pixels. Vary the blur, if you want. I have made the border opaque, but I'm not sure if that's what you want.
This Windows BAT script gives a border of 4 pixels. Vary the blur, if you want. I have made the border opaque, but I'm not sure if that's what you want.
Code: Select all
convert ^
rose: ^
( +clone ^
-bordercolor None -border 4 ^
-blur 0x1 ^
-alpha off ^
) ^
+swap ^
-gravity Center -composite ^
out.png
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Content-aware image extent?
see distort srt with viewport at http://www.imagemagick.org/Usage/distor ... t_viewport and set the virtual-pixel appropriately for extending the border. see http://www.imagemagick.org/script/comma ... tual-pixel
If on unix, see my script imageborder at the link below
If on unix, see my script imageborder at the link below
Re: Content-aware image extent?
Right, thanks, that's it! You can run *nix shell scripts on Windows through cygwin (or msys/mingw) bash just fine btw.fmw42 wrote:If on unix, see my script imageborder at the link below
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Content-aware image extent?
Marsu42 wrote:Right, thanks, that's it! You can run *nix shell scripts on Windows through cygwin (or msys/mingw) bash just fine btw.fmw42 wrote:If on unix, see my script imageborder at the link below
Yes, I know that. Usually I mention Linux, Mac OS or Window with Cygwin. Just got lazy this time above and so just said unix.