Photo to Sketch Converter
Convert photos to realistic pencil drawings using the Color Dodge Blending algorithm. Features adjustable graphite density, hatching simulation, and paper textures.
Drop an image here or click Upload
Supports JPG, PNG, WEBPAbout
Converting digital photography into analog-style art requires more than simple edge detection. While basic tools use the Sobel operator to find boundaries, this Professional Photo to Sketch Converter employs a Gaussian-Invert-Dodge workflow used by high-end raster graphics editors. This method simulates the accumulation of graphite on paper by interacting with the luminance values of the image, rather than just its geometry. The result is a natural, shaded drawing with continuous tones rather than harsh, jagged lines.
The transformation occurs in four mathematical stages. First, the image is desaturated to grayscale based on perceptual luminance. Second, the grayscale data is inverted (photographic negative). Third, a separable Gaussian Blur is applied to the negative; the radius of this blur effectively dictates the "sharpness" of the pencil tip. Finally, the blurred negative is blended with the original grayscale layer using the Color Dodge formula. This operation brightens the base layer based on the blend layer, causing areas with high local contrast to emerge as dark strokes while washing out uniform areas into white paper.
Formulas
The core of the artistic effect lies in the Color Dodge blending mode. Unlike standard arithmetic addition or multiplication, Color Dodge divides the base layer by the inverted blend layer. Let B be the base grayscale pixel and A be the blurred inverted pixel (the blend layer).
When A (the blurred negative) approaches 255 (white), the denominator approaches zero, driving the result towards infinity (clamped at 255). This creates extreme contrast at edges where the blurred mask differs from the sharp original. To control the "darkness" or graphite density, we apply a final Gamma correction:
Reference Data
| Stage | Mathematical Operation | Role in Sketching | Complexity |
|---|---|---|---|
| Luminance | L = 0.2126R + 0.7152G + 0.0722B | Converts color to grayscale matching human eye sensitivity. | O(n) |
| Inversion | Iinv = 255 − L | Creates a negative mask to isolate shading. | O(n) |
| Gaussian Kernel | G(x) = 1√2πσ2 e-(x2/2σ2) | Spreads pixel intensity to simulate soft pencil shading. | O(n ⋅ r) |
| Color Dodge | Cfinal = { 0 if Cbase = 0Cbase × 255255 − Cblend otherwise | The core blending mode that creates the sketch look. | O(n) |
| Gamma Correction | Vout = A × Vinγ | Adjusts the dynamic range to darken faint pencil strokes. | O(n) |