Skip to main content

Pencil Art Generator from Images

Project description

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:

  1. Grayscale Conversion: The input image is converted to grayscale to reduce color complexity.
  2. Gaussian Blurring: A Gaussian blur is applied to the grayscale image to smooth out details.
  3. Inversion: The blurred image is inverted.
  4. 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-python version 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pencil_art-0.1.8.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pencil_art-0.1.8-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file pencil_art-0.1.8.tar.gz.

File metadata

  • Download URL: pencil_art-0.1.8.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pencil_art-0.1.8.tar.gz
Algorithm Hash digest
SHA256 29a08f2578e6a2de2584951a517774c8cd51c64d5c814a9e822a4af5292f3d3f
MD5 4adbe3ee221b7cb46e423444faca6d4d
BLAKE2b-256 63ea8dcb7b749eef9adecfd2ae038b7681e70ceb1676b82b2c33cfba2a9a2dab

See more details on using hashes here.

File details

Details for the file pencil_art-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: pencil_art-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pencil_art-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 9e7f6e4425efe3e3be9bd5b0601f2060e9da4387a7a3531268de8d007612e8cd
MD5 c9e490226590c8255dd98bd1a7dd7990
BLAKE2b-256 89b738082ecffbcd409f1848ac44ceb569b7d3cab0088409ea286faa048d1620

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page