Code Monkey home page Code Monkey logo

imgscii's People

Contributors

campbellized avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

imgscii's Issues

Program prints raw ANSI escape codes in addition to ASCII characters.

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:

  1. Run git diff in the console.
  2. Run 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

CLI doesn't accept strings as typed, and does not cast input as integer when needed

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.

Program crashes when it is passed a PNG file

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.