ImageEn, unit imageenproc

TImageEnProc.PencilSketch

TImageEnProc.PencilSketch


Declaration

procedure PencilSketch(GrayScale: boolean = true; LevelSteps: integer = 2; MaxTextures: integer = MAXINT; EdgeBlurAmount: integer = 4; EdgeAmount: double = 0.5; LineThickness: double = 1; DarkeningFactor: double = 0.1; LineAlpha: double = 0.1; LineDensity: double = 0.5; Lightness: double = 4; AntialiasedLines: boolean = false);


Description

Transform an image or selected area into a pencil sketch.
This method can be very slow for large images or for particular combination of parameters (like LevelSteps and AntialiasedLines).
It also requires a lot of memory and can fail processing large images.

Parameter Description
GrayScale If True, output will be gray scale
LevelSteps Number of colors to detect in image. Suggested range: 2 to 6
MaxTextures Overcome LevelSteps parameter, specifying the maximum number of textures (colors) to generate
EdgeBlurAmount Thickness of edges. Suggested range: 2 to 10
EdgeAmount The edge amount. Suggested range: 0 to 2
LineThickness Thickness of drawn lines. Suggested range: 0.5 to 10
DarkeningFactor Darkness of output image. Suggested range: 0 to 10
LineAlpha Transparency (alpha) of drawn lines. Suggested range: 0.05 to 0.5
LineDensity Density of drawn lines (how many lines are drawn in the textures). Suggested range: 0.25 to 1
Lightness Overall lightness of the output image. Suggested range: 1 to 8
AntialiasedLines If True, texture lines are drawn with antialiasing routine

Original image:


Applying PencilSketch() to the selected areas:


Applying PencilSketch(false) to the selected areas:



Demo

Demo  Demos\ImageEditing\PencilSketch\PencilSketch.dpr