Code Monkey home page Code Monkey logo

python-imgcat's People

Contributors

ppwwyyxx avatar toyama0919 avatar wookayin 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-imgcat's Issues

[Feature request] pipe arg list

Great tool.

It would be v. useful to have the option to do this:
ls | xargs imgcat

The main use case (at least for me) is when you want a quick visual summary from a large directory of images. E.g.
ls | shuf | head -n 10 | xargs imgcat

This works with the original imgcat, but with python-imgcat, I get the following:
error: when reading from stdin, arg should not be given

Thanks!

Not working with xargs

If I try to run this excellent tool inside a command such as this (which I do heavily):

find images/ -iname "*dog*.jpg" | xargs -n 1 imgcat

you get:

error: when reading from stdin, arg should not be given

What should happen in this usage model is that imgcat should run one arg at a time on each file that matches the glob pattern *dog*.jpg.

Is there any chance this can be fixed? Once it is, the tool is perfect :)

Fails with IPython

In an IPython (or Jupyter) console, imgcat errors and fails to load images, even when using kitty and explicitly setting the TERM environment variable to xterm-kitty. I'm not sure if this a bug report or feature request (or even a problem with Jupyter!), especially since the IPython/Jupyter console explicitly changes the TERM environment variable. I think this would be a useful feature/fix in any case, as an IPython provides many benefits over a python REPL.

Steps to reproduce:
-Start an IPython or Jupyter console using kitty (problem occurs with both python 3.6 and 3.8 for me)
-Explicitly change TERM value with %set_env TERM=xterm-kitty [or don't, doesn't make a difference in the outcome :)]
-Set matplotlib backend to imgcat, and plot something
-imgcat throws 'OutStream' object has no attribute 'buffer'

The module is working perfectly for me in kitty in a python REPL. Thanks for this great project!

Error when using with `networkx` module

  • I can't seem to get these 3 things (a.) networkx (b.) matplotlib.pyplot (c.) imgcat to work together... (ab) work together well verified, (bc) work together per the imagecat documentation, (c) alone work well verified... but how to get (abc) to work 😅 ?
  • I am pretty sure i am making some silly mistake, but can't figure out.
# Works Well
from imgcat import imgcat
imgcat(open("Figure_1.png"))

I was thinking maybe there's some way to plt.savefig() to some variable then render that via imgcat() but that doesn't seeem to work either...

import matplotlib
matplotlib.use("module://imgcat")

import networkx as nx
import matplotlib.pyplot as plt
# from imgcat import imgcat

edges = [(1,2),(2,3),(2,4)]

nxgraph = nx.Graph()
nxgraph.add_edges_from(edges)

nx.draw_networkx(nxgraph)
# fig = nx.draw_networkx(nxgraph)
plt.show()
# plt.savefig()
# imgcat(fig)
Show Stack Trace Back
Traceback (most recent call last):
  File "<DIR>\nx-pydot-graphviz-imgcat.py", line 15, in <module>
    nx.draw_networkx(nxgraph)
  File "D:\ProgramFiles\Python\Python311\Lib\site-packages\networkx\drawing\nx_pylab.py", line 303, in draw_networkx
    draw_networkx_nodes(G, pos, **node_kwds)
  File "D:\ProgramFiles\Python\Python311\Lib\site-packages\networkx\drawing\nx_pylab.py", line 416, in draw_networkx_nodes
    ax = plt.gca()
         ^^^^^^^^^
  File "D:\ProgramFiles\Python\Python311\Lib\site-packages\matplotlib\pyplot.py", line 2309, in gca
    return gcf().gca()
           ^^^^^
  File "D:\ProgramFiles\Python\Python311\Lib\site-packages\matplotlib\pyplot.py", line 906, in gcf
    return figure()
           ^^^^^^^^
  File "D:\ProgramFiles\Python\Python311\Lib\site-packages\matplotlib\_api\deprecation.py", line 454, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "D:\ProgramFiles\Python\Python311\Lib\site-packages\matplotlib\pyplot.py", line 861, in figure
    draw_if_interactive()
  File "D:\ProgramFiles\Python\Python311\Lib\site-packages\matplotlib\pyplot.py", line 397, in draw_if_interactive
    return _get_backend_mod().draw_if_interactive(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ProgramFiles\Python\Python311\Lib\site-packages\matplotlib\backend_bases.py", line 3583, in draw_if_interactive
    manager_class = cls.FigureCanvas.manager_class
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'manager_class'

AttributeError: module 'imgcat' has no attribute 'FigureCanvas'

I got the following error.
It seems that matplotlib.use(module://imgcat) is not working.

Below is an example of an error made by a one-liner
I get the same error with matplotlib.use(module://imgcat)

$ MPLBACKEND="module://imgcat" python -c 'import imgcat, matplotlib.pyplot as plt; plt.show()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/hiroshi.toyama/.pyenv/versions/3.10.8/lib/python3.10/site-packages/matplotlib/pyplot.py", line 526, in show
    _warn_if_gui_out_of_main_thread()
  File "/Users/hiroshi.toyama/.pyenv/versions/3.10.8/lib/python3.10/site-packages/matplotlib/pyplot.py", line 441, in _warn_if_gui_out_of_main_thread
    canvas_class = cast(type[FigureCanvasBase], _get_backend_mod().FigureCanvas)
  File "/Users/hiroshi.toyama/.pyenv/versions/3.10.8/lib/python3.10/site-packages/matplotlib/pyplot.py", line 280, in _get_backend_mod
    switch_backend(rcParams._get("backend"))  # type: ignore[attr-defined]
  File "/Users/hiroshi.toyama/.pyenv/versions/3.10.8/lib/python3.10/site-packages/matplotlib/pyplot.py", line 343, in switch_backend
    canvas_class = module.FigureCanvas
AttributeError: module 'imgcat' has no attribute 'FigureCanvas'

Run and install imgcat on server issue

Hello @wookayin i want to Run and install imgcat on server (linux based) to directly view images on server rather view it on Mac. I use MobaXterm to connect to server, while, my basic question is that there is any way i can install imgcat on my server to view images on server, rather, i install another software on my laptop and then run imgcat on the laptop to see images? I hope you understand my issue.

Remove pytest-runner from setup_requires

Due to pytest-runner being in a deprecated state (as seen in references [1] [2]), it is recommended that the author clean up the dependency of imgcat on pytest-runner. Conflicts caused by this dependency can lead to incorrect installation issues during pip install.

[1] https://github.com/pytest-dev/pytest-runner/
[2] https://pypi.org/project/pytest-runner/

Deprecation Notice
pytest-runner depends on deprecated features of setuptools and relies on features that break security mechanisms in pip. For example ‘setup_requires’ and ‘tests_require’ bypass pip --require-hashes. See also pypa/setuptools#1684.

It is recommended that you:

Remove 'pytest-runner' from your setup_requires, preferably removing the setup_requires option.

Remove 'pytest' and any other testing requirements from tests_require, preferably removing the tests_requires option.

Select a tool to bootstrap and then run tests such as tox.

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.