Copyright © Fred Weinhaus My scripts are available free of charge for non-commercial (non-profit) 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 Please read the Pointers For Use on my home page to properly install and customize my scripts. |
Applies a puzzle like effect to an image. |
last modified: July 11, 2022
USAGE: puzzle [-s scale] [-o ocolor] [-e ecolor] [-m missing] [-n newseed] [-r rotation] [-x xoffset] [-y yoffset] [-O opacity] [-D depth] [-length] infile outfile
-s ... scale ..... puzzle pieces scale factor; integer>=50; default=100 PURPOSE: To apply a puzzle like effect to an image. DESCRIPTION: PUZZLE applies a puzzle like effect to an image. Options include: setting the number of missing pieces, setting the missing piece color and the outline color and overlaying the missing pieces at some rotation or offset. ARGUMENTS: -s scale ... SCALE is the puzzle cell scale factor. Values are integers>=50. The default=100. At scale of 100, the size of a cell is about 50x50 pixels. -o ocolor ... OCOLOR is the puzzle piece outline color. Any valid IM color is allowed or the special value of "carve" (without the quotes). The default=gray40. Using carve will produce a carved-like effect to the puzzle. The default=gray40. -e ecolor ... ECOLOR is the color used to fill empty (missing) pieces. Any valid IM color is allowed. The default=white. -m missing ... MISSING is the number of missing (empty) pieces. Values are 0<=integer<=20. The default=0. -n newseed ... NEWSEED is the seed for random missing pieces. Values are non-negative integers. The default is no seed. Thus the pattern will not be repeatable. -r rotate ... ROTATE is the rotation angle of overlaid missing pieces. Values are -360<=integer<=360. The default=0. Pieces will not be overlaid unless at least one of rotate, xoffset, yoffset are non-zero. -x xoffset ... XOFFSET is the x offset of overlaid missing pieces. Value are integers (positive or negative). The default=0. Pieces will not be overlaid unless at least one of rotate, xoffset, yoffset are non-zero. -y yoffset ... YOFFSET is the y offset of overlaid missing pieces. Value are integers (positive or negative). The default=0. Pieces will not be overlaid unless at least one of rotate, xoffset, yoffset are non-zero. -O opacity ... OPACITY for shadow effect on overlaid missing pieces. Values are 0<=integer<=100. The default=0. -D depth ... DEPTH for shadow effect on overlaid missing pieces. Values are integer>=0. The default=3. -L length ... LENGTH of shadow on overlaid missing pieces. Values are integer>=0. The default=3. Requirements: IM 6.5.9.3 or higher due to the use of 1D morphology edge. References - svg puzzle pattern modified from: http://www.joshpodolske.com/puzzle-pieces-vector-swatch/ 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. |
Example 1 |
Original |
![]() |
Arguments: |
![]() |
Arguments: |
![]() |
Arguments: |
![]() |
Arguments: |
![]() |
Arguments: |
![]() |
Arguments: |
![]() |
Arguments: |
![]() |
Example 2 |
Original |
![]() |
Arguments: |
![]() |
Arguments: |
![]() |
Arguments: |
![]() |
What the script does is as follows:
This is equivalent to the following IM commands
|