Fred's ImageMagick Scripts



    Licensing:

    Copyright © Fred Weinhaus

    My scripts are available free of charge for non-commercial use, ONLY.

    For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net.

    If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment.

    Usage, whether stated or not in the script, is restricted to the above licensing arrangements. It is also subject, in a subordinate manner, to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php

SHAPECLUSTER


Creates a division of the image into 9 separated rectangular regions.

Download Script

last modified: September 26, 2017



USAGE: shapecluster [-t thickness] [-d darkness] [-r rolloff] [-e extent] [-b border] [-c color] [infile] [outfile]
USAGE: shapecluster [h|-help]

-t ... thickness ... thickness of the region separation; integer>0; default=10
-d ... darkeness ... darkeness of the shadows; 0<=integer<=100; default=60
-r ... rolloff ..... rolloff of the shadow darkness; integer>=0; default=2
-e ... extent ...... extent (distance) of the shadow; integer>=0; default=5
-b ... border ...... border applied to output image; integer>=0; default=20
-c ... color ....... border color; default=white

.

PURPOSE: To create a division of the image into 5 separated rectangular regions.

DESCRIPTION: SHAPECLUSTER creates a division of the image into 5 separated rectangular regions. Each region is separated with a shadowed background.

ARGUMENTS:

-t thickness ... THICKNESS of the region separation. Values are integers>0. The default=10.

-d darkeness ... DARKNESS of the frame shadow. Values are 0<=integer<=100. The default=60.

-r rolloff ... ROLLOFF (fading) of the shadow darkness. Values are integer>=0. The default=3.

-e extent ... EXTENT (distance) of the shadow. Values are integer>=0; default=5.

-b border ... BORDER around output image. Values are integer>=0. The default=20.

-c color ... COLOR is the background and border color. Any valid opaque IM color is allowed. The default=white.

Reference:
http://www.photoshopessentials.com/photo-effects/photo-in-photo/

CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk.


EXAMPLES


Example

Original Image
(source)

 

Arguments:
defaults

 

Arguments:
-c tan


What the script does is as follows:

  • Read input and create white mask image with lines drawn in black
  • Put mask into alpha channel of input
  • Create shadow image
  • Apply shadow to image
  • Flatten against background/bordercolor
  • Pad image with bordercolor border
  • Write output

  • ww=`convert -ping $tmpA1 -format "%w" info:`
  • hh=`convert -ping $tmpA1 -format "%h" info:`
  • w13=`convert xc: -format "%[fx:round($ww/3)]" info:`
  • h13=`convert xc: -format "%[fx:round($hh/3)]" info:`
  • w23=$((ww-w13))
  • h23=$((hh-h13))
  • convert \( $tmpA1 \( -size ${ww}x${hh} xc:white \
    -fill white -stroke black -strokewidth $thickness -draw \
    "line $w13,0 $w13,$h23 \
    line $w13,$h13 $ww,$h13 \
    line 0,$h23 $w23,$h23 \
    line $w23,$h13 $w23,$hh" \
    -alpha off +repage \) \
    -alpha off -compose copy_opacity -composite -compose over \) \
    \( +clone -background black -shadow ${darkeness}x${rolloff}+${extent}+${extent} \) \
    +swap -background none -layers merge +repage \
    -background $color -compose over -flatten \
    -bordercolor $color -border $border \
    "$outfile"