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
- Create a
pipenv-managed virtual environment and install the latest version of the package installed:
pipenv install -i https://test.pypi.org/simple/ asciiarttools
- Activate the virtual environment:
pipenv shell
- 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
- 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".
- 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'
- 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.
- 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
- Clone the repository
git clone https://github.com/software-students-fall2022/python-package-exercise-project-3-team-8.git
- Set up the environment
pipenv shell
- Install the dependencies
pipenv install --dev
- Modify the code
- To build the package, run the following command:
python -m build
- To test the package, run the following command:
python -m pytest
Link to Example Python Program
Link to package's page on the PyPI website
https://test.pypi.org/project/asciiarttools/
Contributors
Metadata
Release files for asciiarttools 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| asciiarttools-0.0.3.tar.gz | 45.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asciiarttools-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 76.8 kB
Release files / asciiarttools-0.0.3.tar.gz
| Download URL | asciiarttools-0.0.3.tar.gz |
|---|---|
| Size | 45.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17b1518cc35624ff1c767807eb23cf73d2ba3bd45709862fbe48d0c210e50324
|
|
BLAKE2b-256 checksum How to use checksums |
c78f52743f591cb2aa68bc5284aee987c04b33ba8cf2135ed4da4d78cb582789
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.7
|
Release files / asciiarttools-0.0.3-py3-none-any.whl
| Download URL | asciiarttools-0.0.3-py3-none-any.whl |
|---|---|
| Size | 31.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4db44211cdb5eb10249a6b67275c95bbfc563990883c64066d17aedda8dec210
|
|
BLAKE2b-256 checksum How to use checksums |
5e89b7bb55f159095b53c6d8a2d7671131b8d1ce089575c44eaea52aac20f36a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.7
|
Security for asciiarttools 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.