---
name: Pencil Sketch
slug: pencil4img
category: Automation
description: Converts images to pencil sketch style. Use when you need to turn a photo into a pencil drawing or sketch.
github: "https://github.com/CoderWanFeng/python-office/tree/develop/skills/image/pencil4img"
language: Python
stars: 1331
forks: 297
install: "git clone https://github.com/CoderWanFeng/python-office"
added: 2026-07-20T06:48:51.325Z
last_synced: 2026-07-28T07:00:56.139Z
canonical_url: "https://dirskills.com/skills/pencil4img"
---

# Pencil Sketch

Converts images to pencil sketch style. Use when you need to turn a photo into a pencil drawing or sketch.

**Install:** `git clone https://github.com/CoderWanFeng/python-office`

## README

# pencil4img Skill

> 使用 pencil4img 算法处理图像

## 功能描述

将输入的图像转换为铅笔画风格的图像。

## 所属分类

`office/skills/image/pencil4img/`

## 调用方式

```python
from office.skills.image import pencil4img

pencil4img(
    input_img='./test.jpg',
    output_path='./',
    output_name='pencil4img.jpg'
)
```

## 参数说明

| 参数 | 类型 | 必填 | 默认值 | 说明 |
|------|------|------|--------|------|
| `input_img` | str | 是 | - | 输入的图像文件路径 |
| `output_path` | str | 否 | `'./'` | 输出图像的路径 |
| `output_name` | str | 否 | `'pencil4img.jpg'` | 转换后的图像文件名 |

## 返回值

`None`

## 使用示例

```python
from office.skills.image import pencil4img
pencil4img(input_img='./photo.jpg')
```

## 原始函数

`office.api.image.pencil4img`
