Pencil Art
pencil_art is a Python package that converts images into pencil sketches using OpenCV. It provides a simple way to create a pencil sketch effect from a given image by applying image processing techniques such as grayscale conversion, Gaussian blurring, and inversion.
Installation
To install the pencil_art package, use the following pip command:
pip install pencil_art
Usage
Basic Example
from pencil_art import pencil_art
# Specify the input image path and output path for the pencil sketch
input_image = 'path_to_your_image.jpg'
output_image = 'output_sketch.jpg'
# Convert the image to a pencil sketch
pencil_art(input_image, output_image)
Function: pencil_art
pencil_art(input_image_path, output_image_path)
Parameters:
input_image_path(str): The path to the input image file that you want to convert to a pencil sketch.output_image_path(str): The path where the resulting pencil sketch will be saved.
Returns:
- This function does not return any value. The pencil sketch image will be saved to the specified output path.
Example:
input_image = 'sample_image.jpg'
output_image = 'sketched_output.jpg'
pencil_art(input_image, output_image)
This will read the image located at input_image, convert it to a pencil sketch, and save it as output_image.
How It Works
The pencil_art function performs the following steps to generate the pencil sketch effect:
- Grayscale Conversion: The input image is converted to grayscale to reduce color complexity.
- Gaussian Blurring: A Gaussian blur is applied to the grayscale image to smooth out details.
- Inversion: The blurred image is inverted.
- Sketch Creation: The pencil sketch effect is achieved by dividing the original grayscale image by the inverted blurred image.
Dependencies
The pencil_art package requires the opencv-python library. It is automatically installed when you install pencil_art.
opencv-pythonversion 4.5.0 or later
Contributing
If you'd like to contribute to the development of the pencil_art package, feel free to fork the repository, make changes, and submit a pull request. We welcome improvements, bug fixes, and new features.
License
This package is licensed under the MIT License.
Metadata
Release files for pencil-art 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pencil_art-0.1.8.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pencil_art-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.4 kB
Release files / pencil_art-0.1.8.tar.gz
| Download URL | pencil_art-0.1.8.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29a08f2578e6a2de2584951a517774c8cd51c64d5c814a9e822a4af5292f3d3f
|
|
BLAKE2b-256 checksum How to use checksums |
63ea8dcb7b749eef9adecfd2ae038b7681e70ceb1676b82b2c33cfba2a9a2dab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / pencil_art-0.1.8-py3-none-any.whl
| Download URL | pencil_art-0.1.8-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e7f6e4425efe3e3be9bd5b0601f2060e9da4387a7a3531268de8d007612e8cd
|
|
BLAKE2b-256 checksum How to use checksums |
89b738082ecffbcd409f1848ac44ceb569b7d3cab0088409ea286faa048d1620
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|