Coder Social home page Coder Social logo

img2unicode's People

Contributors

matrach avatar paw-lu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

img2unicode's Issues

renderer TypeError: missing 1 required positional argument

Get the error with: img2unicode.ExactGammaOptimizer() and img2unicode.BasicGammaOptimizer()

img2unicode\renderer.py", line 82, in optimize
    chars, fgs, bgs = optimizer.optimize_chunk(img)
TypeError: BasicGammaOptimizer.optimize_chunk() missing 1 required positional argument: 'img_edges'

Exception: multichannel

It looks like that skimage has removed the multichannel=True parameter (again? found an old post that it was added in 0.14).
https://github.com/matrach/img2unicode/blame/1eea995bf441e0f141312e9db0f1533d20b124f3/img2unicode/renderer.py#L72
Tested a few versions of skimage, but didn't work works with 0.19.3. Removing multichannel=True fixes the issue.

Traceback (most recent call last):
  File "C:\Users\Gamer\Documents\Projekte\coding\python\pyToot\main.py", line 26, in <module>
    keep_running = main_menu()
  File "C:\Users\Gamer\Documents\Projekte\coding\python\pyToot\main.py", line 16, in main_menu
    readToots.read_toots()
  File "C:\Users\Gamer\Documents\Projekte\coding\python\pyToot\readToots.py", line 94, in read_toots
    display_toots(toots)
  File "C:\Users\Gamer\Documents\Projekte\coding\python\pyToot\readToots.py", line 67, in display_toots
    print_media_attachments(original_toot.get("media_attachments", []))
  File "C:\Users\Gamer\Documents\Projekte\coding\python\pyToot\readToots.py", line 45, in print_media_attachments
    terminal_image.render_image(attachment["url"])
  File "C:\Users\Gamer\Documents\Projekte\coding\python\pyToot\inc\TerminalImage.py", line 24, in render_image
    renderer.render_terminal(local_image, sys.stdout)
  File "C:\Users\Gamer\Documents\Projekte\coding\python\pyToot\venvs\venv3_10\lib\site-packages\img2unicode\renderer.py", line 108, in render_terminal
    chars, fgs, bgs = self.render_numpy(path_or_img, optimizer, **kwargs)
  File "C:\Users\Gamer\Documents\Projekte\coding\python\pyToot\venvs\venv3_10\lib\site-packages\img2unicode\renderer.py", line 112, in render_numpy
    img, chars, fgs, bgs = self.optimize(path_or_img, optimizer, **kwargs)
  File "C:\Users\Gamer\Documents\Projekte\coding\python\pyToot\venvs\venv3_10\lib\site-packages\img2unicode\renderer.py", line 81, in optimize
    img = self._prepare_image(self._ensure_image(path_or_img))
  File "C:\Users\Gamer\Documents\Projekte\coding\python\pyToot\venvs\venv3_10\lib\site-packages\img2unicode\renderer.py", line 73, in _prepare_image
    ims = skimage.filters.gaussian(ims, 1, multichannel=True)
TypeError: gaussian() got an unexpected keyword argument 'multichannel'

Process finished with exit code 1

PIL.Image.frombytes missing required arguments `size` and `data`

Inputting the bytes representation of an image results in

import io

import img2unicode

decoded_image = ...  # Bytes representation of image
output = io.StringIO()
optimizer = img2unicode.FastGenericDualOptimizer("block")
renderer = img2unicode.Renderer(default_optimizer=optimizer, max_h=60, max_w=160)
renderer.render_terminal(decoded_image, file=output)
Traceback (most recent call last):
  File "/Users/pawlu/Documents/scratch/teimpy/image.py", line 134, in <module>
    renderer.render_terminal(decoded_image, file=output2)
  File "/Users/pawlu/Documents/scratch/teimpy/.venv/lib/python3.9/site-packages/img2unicode/renderer.py", line 106, in render_terminal
    chars, fgs, bgs = self.render_numpy(path_or_img, optimizer, **kwargs)
  File "/Users/pawlu/Documents/scratch/teimpy/.venv/lib/python3.9/site-packages/img2unicode/renderer.py", line 110, in render_numpy
    img, chars, fgs, bgs = self.optimize(path_or_img, optimizer, **kwargs)
  File "/Users/pawlu/Documents/scratch/teimpy/.venv/lib/python3.9/site-packages/img2unicode/renderer.py", line 79, in optimize
    img = self._prepare_image(self._ensure_image(path_or_img))
  File "/Users/pawlu/Documents/scratch/teimpy/.venv/lib/python3.9/site-packages/img2unicode/renderer.py", line 62, in _ensure_image
    img = PIL.Image.frombytes(path_or_img)
TypeError: frombytes() missing 2 required positional arguments: 'size' and 'data'

Seems only one required argument is given in renderer.py:

img = PIL.Image.frombytes(path_or_img)

While 3 are required—mode, size, and data.


Thanks for sharing your work!

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.