imgcat作为python api和cli

imgcat的Python项目详细描述


imgcat

pypiBuild Statuslicense

imgcat cli,用python编写(还有python api)。

它可以与iTerm2一起工作,甚至可以在tmux内部工作。

安装和使用

pip install imgcat

命令行接口(类似于iTerm2's imgcat):

$ imgcat local_image.png
$ imgcat a.png b.png c.png
$ cat from_stdin.gif | imgcat

# height is 10 lines
$ imgcat a.png --height 10

python api:

>>>fromimgcatimportimgcat# from the content of image (e.g. buffer in python3, str in python2)>>>imgcat(open("./local_image.png"))# or numpy arrays!>>>im=skimage.data.chelsea()# [300, 451, 3] ndarray, dtype=uint8>>>imgcat(im,height=7)# matplotlib, PIL.Image, etc.>>>imgcat(Image.fromarray(im))>>>importmatplotlib.pyplotasplt>>>fig,ax=plt.subplots();ax.plot([1,2,3,4,5])>>>imgcat(fig)

matplotlib后端:module://imgcat

MPLBACKEND="module://imgcat"pythondraw_matplotlib.py
>>>importmatplotlib>>>matplotlib.use("module://imgcat")>>>importmatplotlib.pyplotasplt>>>fig,ax=plt.subplots()>>>ax.text(0.5,0.5,"Hello World!");>>>fig.show()# an image shall be displayed on your terminal!

注释

相关项目

许可证

MIT License

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
在MATLAB中生成java格式的矩阵   java混合图片,颜色为白色   java Apache Tomcat 7域问题代理设置   java无法从资产中读取csv文件   java为SpringFramework 5中的所有控制器和方法指定一个模式   java为我的应用程序打开html帮助页面   java中的条件语句。属性文件   数组Java彩票类   javascript允许Rhino使用当前项目中的Java类   java无法将ModelMap添加到会话   Java执行命令行程序   java这个电子邮件程序是如何工作的?   java自定义listview,视图问题   java将变量从JavaFx传递到JavaScript&编写代码来触发按钮   java从csv文件中删除记录   爪哇移动蝙蝠。重新油漆   socketjava断开连接   已解析页面的java HTML