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:


Note:
A UI for this is available to your users in the Image Processing dialog
Also available as a RetouchTool by setting MouseInteractGeneral to [miRetouchTool] and RetouchMode to iermPencilSketch
If the image PixelFormat is not ie24RGB, it will be converted


Demos

Demo  Demos\ImageEditing\PencilSketch\PencilSketch.dpr
Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Examples

// Load test image
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );

  

// Transform image into a monochrome pencil sketch
ImageEnView1.Proc.PencilSketch( True );

  

// Transform image into a color pencil sketch
ImageEnView1.Proc.PencilSketch( False );