campbellized / imgscii Goto Github PK
View Code? Open in Web Editor NEWCreate ASCII artwork from images.
License: MIT License
Create ASCII artwork from images.
License: MIT License
Occasionally the program will print ANSI escape codes joined together with the ASCII characters. The output looks something like this:
How many columns do you want your ASCII art to be?
10
[31m$[0m[30m%[0m[30m?[0m[30m?[0m[30m?[0m[30m?[0m[30m#[0m[30m#[0m[36mQ[0m[36mQ[0m
[30m%[0m[30m%[0m[30m%[0m[30m%[0m[33m%[0m[34m%[0m[30m?[0m[30m%[0m[36m+[0m[36mQ[0m
[30m%[0m[31m$[0m[33m$[0m[33m$[0m[33mQ[0m[33m,[0m[34mQ[0m[32mQ[0m[30m%[0m[30m%[0m
[33m$[0m[33mQ[0m[33m+[0m[33m+[0m[33m+[0m[33m+[0m[33mj[0m[37m.[0m[34m+[0m[35m$[0m
[33mQ[0m[33m+[0m[33m,[0m[33m,[0m[33m+[0m[33m*[0m[33m~[0m[33m*[0m[37m~[0m[37m.[0m
[33m+[0m[33m,[0m[33m*[0m[33m*[0m[37m`[0m[33m~[0m[33m~[0m[33m*[0m[33mj[0m[33mj[0m
I can reliably produce this issue by the following steps:
git diff
in the console.python imgscii.py
in the same console.I'm not sure what could cause such an issue and I'm not sure if other command line tools might trigger the same behavior. I tested this on Windows 10 Pro 64-bit with Python 3.5.2, Anaconda 4.1.1
First no-no:
python /Library/Python/2.7/site-packages/imgscii/
__init__.py __init__.pyc imgscii.py imgscii.pyc
STRIPPER:ascii tim$ python /Library/Python/2.7/site-packages/imgscii/
__init__.py __init__.pyc imgscii.py imgscii.pyc
STRIPPER:ascii tim$ python /Library/Python/2.7/site-packages/imgscii/
__init__.py __init__.pyc imgscii.py imgscii.pyc
STRIPPER:ascii tim$ python /Library/Python/2.7/site-packages/imgscii/imgscii.py
What is the name of the image?
~/Desktop/berd.png
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/imgscii/imgscii.py", line 252, in <module>
main()
File "/Library/Python/2.7/site-packages/imgscii/imgscii.py", line 35, in main
file_name = input("What is the name of the image?\n")
File "<string>", line 1
~/Desktop/berd.png
^
SyntaxError: invalid syntax
OK, so I need to put quotes around my image name. Not that bad, but now...
python /Library/Python/2.7/site-packages/imgscii/imgscii.py
What is the name of the image?
"/Users/tim/Desktop/berd.png"
How many columns do you want your ASCII art to be?
40
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/imgscii/imgscii.py", line 252, in <module>
main()
File "/Library/Python/2.7/site-packages/imgscii/imgscii.py", line 60, in main
printscii(file_name, monochrome=args.monochrome, columns=columns)
File "/Library/Python/2.7/site-packages/imgscii/imgscii.py", line 242, in printscii
image = resize_image(image, width)
File "/Library/Python/2.7/site-packages/imgscii/imgscii.py", line 98, in resize_image
return img.resize((round(new_width), round(new_height)))
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 1645, in resize
return self._new(self.im.resize(size, resample))
TypeError: integer argument expected, got float
I enter an integer and it thinks it's a float? Looks like you need to do some casting... int(input)
.
I also tried typing int(40)
and no dice.
This is the result of attempting to load a PNG file:
Traceback (most recent call last):
File ".\imgscii.py", line 144, in <module>
main()
File ".\imgscii.py", line 35, in main
ascii_image = readPixelData(image, columns)
File ".\imgscii.py", line 83, in readPixelData
color = getColor(p)
File ".\imgscii.py", line 115, in getColor
(r, g, b) = pixel
ValueError: too many values to unpack (expected 3)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.