matrach / img2unicode Goto Github PK
View Code? Open in Web Editor NEWA tool to display images as Unicode in your terminal
License: MIT License
A tool to display images as Unicode in your terminal
License: MIT License
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'
n2 seems to have its issues when being installed on macOS.
I'd love to use this work as a dependency in another project. Would it be possible to move n2 to an optional dependency? It seems that it's only used on FastGammaOptimizer
.
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
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
:
img2unicode/img2unicode/renderer.py
Line 61 in 0bc502e
While 3 are required—mode
, size
, and data
.
Thanks for sharing your work!
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.