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 bokeh blurring effect to an image. |
last modified: May 20, 2019
USAGE: bokeh [-d domain] [-s shape] [-r radius] [-p percent] [-t thresh] [-g gain] [-S sharp] [-T type] [-G graphic] infile outfile USAGE: bokeh [-h or -help]
-d ... domain .... convolution domain; choices are: spatial (s) or fourier (f); PURPOSE: To apply a bokeh blurring effect to an image. DESCRIPTION: BOKEH applies a bokeh blurring effect to an image. This can be applied to the whole image or to just the image highlights. A choice of numerous shapes and sizes may be selected. The coloring of the bokeh effect may also be specified. ARGUMENTS: -d domain ... DOMAIN is the convolution domain for applying the bokeh blurring. The choices are: spatial (s) or fourier (f). The default=spatial. Use fourier, when applying the bokeh effect to large images, if speed is an issue. Different artifacts may be observe at the sides of the image when processing with one or the other domain. -s shape ... SHAPE of the convolution kernel. The choices are: triangle, square, pentagon, hexagon, circle, ring and star. The default=pentagon. Note that small circles will not be perfectly round. -r radius ... RADIUS of the shape. The width and height of the shape image will be approximately twice the radius. Values are integer>0. The default=15. -p percent ... PERCENT of the (outer) radius to use for the inner radius of the ring. Values are 0<integer<100. The default=85. Not unused for other shapes. -t thresh ... THRESH is the threshold used to select only highlights in the image to apply the bokeh effect. Values are 0<=integer<=100. The default indicates no thresholding, so that the bokeh effect is applied to the whole image. Nominal values are approximately 90. -g gain ... GAIN to apply to emphasize (brighten) the bokeh effect. Values are float>=0. The default=0 (no emphasis). Nominal value is 2 when a threshold value is not specified and 10 when a threshold value is supplied. Gain when no thesholding will brighten the image, but to a lesser extent than in the highlight regions. -S sharp ... SHARP applies a sharpening of the bokeh effect. Values are integer>=0. The default=10. -T type ... TYPE of bokeh coloring when thresh is supplied. The choices are: grayscale, truecolor or some actual opaque color specification as a color name, hex value or rgb values. Grayscale will apply a grayscale brokeh effect. Truecolor will apply the bokeh effect using the image's color in that region. A color specification will colorize the bokeh effect using that color. The default=truecolor -G graphic ... GRAPHIC mode. The choices are: view (v) or save (s) the shape image. The default is neither. If save is specified, then the graphic image will be saved as shapename.gif to the current directory, where shapename is the name of the shape as listed above. REQUIREMENTS: NetPBM (PGM image format) for domain=spatial. Imagemagick 6.8.7-1 or higher (due to the use of -complex) and HDRI compiled for domain=fourier.
REFERENCES: 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 - Full (No Threshold) vs Highlights Only (Threshold) | |
Original | |
![]() |
|
Arguments: |
Arguments: |
![]() |
![]() |
Arguments: |
Arguments: |
![]() |
![]() |
Arguments: |
Arguments: |
![]() |
![]() |
Arguments: |
Arguments: |
![]() |
![]() |
Arguments: |
Arguments: |
![]() |
![]() |
Arguments: |
Arguments: |
![]() |
![]() |
Example 2 - Grayscale vs TrueColor vs Color Names | |
Original | |
![]() |
|
Arguments: |
Arguments: |
![]() |
![]() |
Arguments: |
Arguments: |
![]() |
![]() |
Arguments: |
Arguments: |
![]() |
![]() |
Arguments: |
Arguments: |
![]() |
![]() |
Arguments: |
Arguments: |
![]() |
![]() |
Arguments: |
Arguments: |
![]() |
![]() |
|
|
|
|
Color Names | |
Arguments: |
Arguments: |
![]() |
![]() |
Example 3 | |
Original | |
![]() |
|
Arguments: |
Arguments: |
![]() |
![]() |
Arguments: |
Arguments: |
![]() |
![]() |
Arguments: |
Arguments: |
![]() |
![]() |
What the script does is as follows:
|