Skip to main content

A package that converts image to ASCII art, developed with pyenv, built with build using setuptools, uploaded to PyPI using twine, and distributed via pip.

Project description

Python build & test

Convert Image to ASCII

ASCII art is a graphic design technique that uses computers for presentation and consists of pictures pieced together from the 95 printable (from a total of 128) characters defined by the ASCII Standard from 1963 and ASCII compliant character sets with proprietary extended characters (beyond the 128 characters of standard 7-bit ASCII). The term is also loosely used to refer to text-based visual art in general. ASCII art can be created with any text editor and is often used with free-form languages. Most examples of ASCII art require a fixed-width font (non-proportional fonts, as on a traditional typewriter) such as Courier for presentation. Among the oldest known examples of ASCII art are the creations by computer-art pioneer Kenneth Knowlton from around 1966, who was working for Bell Labs at the time. “Studies in Perception I” by Ken Knowlton and Leon Harmon from 1966 shows some examples of their early ASCII art. ASCII art was invented, in large part, because early printers often lacked graphics ability and thus characters were used in place of graphic marks. Also, to mark divisions between different print jobs from different users, bulk printers often used ASCII art to print large banners, making the division easier to spot so that the results could be more easily separated by a computer operator or clerk. ASCII art was also used in an early e-mail when images could not be embedded. You can find out more about them. Source : Wiki.
Our project is to convert input image from user and generate the corresponding ASCII output image.

Installation

  1. Create a pipenv-managed virtual environment and install the latest version of the package installed:
pipenv install -i https://test.pypi.org/simple/ asciiarttools
  1. Activate the virtual environment:
pipenv shell
  1. Create a Python program file that imports the package and uses it, e.g.
from asciiarttools import asciiarttools

and then call the functions, for example:

asciiarttools.convertImageToAsciiImage('cat1.jpg', 'output.png')

Functions

  1. Generate a plain ASCII image from input image
convertImageToAscii(fileName, cols, scale, moreLevels, debug,outFile)

Call convertImageToAscii function and pass the input file name, columns number, scale, level of grayscale, debug mode, and output file name. The default value is cols=80, scale=0.43, moreLevels=True,debug=False,outFile="out.txt".

  1. Generate a colored ASCII image from input image
convertImageToAsciiImage(inputImage, outFile='output.png')

Call convertImageToAsciiImage function and pass the input file and output file. The default is outFile='output.png'

  1. Adjust the brightness of a generated ASCII text image
adjustASCIIBrightness(art, value, moreLevels=True)

Call adjustASCIIBrightness function and pass the input ASCII art file, magnitude in adjusting brightness, and level of grayscale. The default is moreLevels=True. The range for value is [-1,1], where value approaches 1 means increases the brightness, and value approaches -1 means decreases the brightness.

  1. Adjust the contrast of a generated ASCII text image
adjustASCIIContrast(art, value, moreLevels=True)

Call adjustASCIIContrast function and pass the input ASCII art file, magnitude in adjusting contrast, and level of grayscale. The default is moreLevels=True.The range for value is [-1,1], where value approaches 1 means sharpen the contrast, and value approaches -1 means soften the contrast.

How to Contribute

  1. Clone the repository
git clone https://github.com/software-students-fall2022/python-package-exercise-project-3-team-8.git
  1. Set up the environment
pipenv shell
  1. Install the dependencies
pipenv install --dev
  1. Modify the code
  2. To build the package, run the following command:
python -m build
  1. To test the package, run the following command:
python -m pytest

Link to Example Python Program

Example Program

Link to package's page on the PyPI website

https://test.pypi.org/project/asciiarttools/

Contributors

Adler, David

Fan, Wenni

Ma, Michael

Zhang, Jiawei

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

asciiarttools-0.0.3.tar.gz (45.0 kB view details)

Uploaded Source

Built Distribution

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

asciiarttools-0.0.3-py3-none-any.whl (31.8 kB view details)

Uploaded Python 3

File details

Details for the file asciiarttools-0.0.3.tar.gz.

File metadata

  • Download URL: asciiarttools-0.0.3.tar.gz
  • Upload date:
  • Size: 45.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.7

File hashes

Hashes for asciiarttools-0.0.3.tar.gz
Algorithm Hash digest
SHA256 17b1518cc35624ff1c767807eb23cf73d2ba3bd45709862fbe48d0c210e50324
MD5 fdc1994264960b0a17c15bd9d2ae835d
BLAKE2b-256 c78f52743f591cb2aa68bc5284aee987c04b33ba8cf2135ed4da4d78cb582789

See more details on using hashes here.

File details

Details for the file asciiarttools-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: asciiarttools-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 31.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.7

File hashes

Hashes for asciiarttools-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4db44211cdb5eb10249a6b67275c95bbfc563990883c64066d17aedda8dec210
MD5 7603252fbd0a382718e597067b728dd0
BLAKE2b-256 5e89b7bb55f159095b53c6d8a2d7671131b8d1ce089575c44eaea52aac20f36a

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