将图像(特别是剪贴板中的图像)存储在数据库中,并旋转图像服务器(供jupyter笔记本使用)。
imagedb的Python项目详细描述
图像数据库
将图像(特别是剪贴板中的图像)存储在数据库中,并旋转图像服务器(供jupyter笔记本使用)。
安装
$ pip install imagedb
或
- 从github克隆项目
poetry add imagedb --path path/to/imagedb/folder
用法
运行图像服务器
在python脚本中(在jupyter笔记本之外)。
fromimagedbimportImageDBImageDB('images.db').runserver()# Then, go to `http://localhost:8000` in your browser to register an image (from the clipboard).
从图像服务器获取图像
在Jupyter笔记本中
>>> from imagedb import ImageDB >>> idb = ImageDB('images.db') >>> idb.last() # The latest image in the server will be shown. `idb.last(5)` is also supported. >>> from IPython.display import display >>> for image in idb.search(tags='bar'): ... display(image) # All images corresponding to the tag 'bar' will be shown.