1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 06:30:03 +08:00
SpaceVim/bundle/defx.nvim/rplugin/python3/defx/preview_image.py

18 lines
572 B
Python
Raw Normal View History

2020-10-31 15:58:52 +08:00
import ueberzug.lib.v0 as ueberzug
import sys
import time
if __name__ == '__main__' and len(sys.argv) > 3:
with ueberzug.Canvas() as c:
total_width = int(sys.argv[2])
preview_width = int(sys.argv[3])
ratio = preview_width / total_width
width = preview_width
demo = c.create_placement(
'demo', x=(total_width - preview_width) * ratio, y=1,
width=width, scaler=ueberzug.ScalerOption.COVER.value)
demo.path = sys.argv[1]
demo.visibility = ueberzug.Visibility.VISIBLE
time.sleep(1)