Skip to content

Instantly share code, notes, and snippets.

@OKsign
Created December 29, 2021 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OKsign/0007438c77b088fd409499237f02d6b4 to your computer and use it in GitHub Desktop.
Save OKsign/0007438c77b088fd409499237f02d6b4 to your computer and use it in GitHub Desktop.
"""
Requirements:
1. merge_images.py from https://github.com/255/merge-images/blob/master/merge_images.py (and requirements for running script)
2. yad (sudo apt install yad)
3. AutoKey (with gtk+, install via Ubuntu Software)
---------------------------------------------------
tested on AutoKey 0.95.10, Ubuntu 20.04.3 LTS
"""
import os
from datetime import datetime
utime = datetime.now()
utime2 = utime.strftime("%Y_%m_%d_%H.%M.%S")
output_file = '/home/john/Desktop/output-combine_images_%s.png' % utime2
script_file = '/home/john/Desktop/merge_images.py'
column = 0
cmd1 = "yad --center --title='Merge Images' --width=300 --height=100 --on-top --text='Drop Here' --dnd"
aa = system.exec_command(cmd1)
bb = aa.replace("file://", "")
bb_sp = bb.split('\n')
list_file = []
for i in bb_sp:
ff = i.replace(" ","\ ")
list_file.append(ff)
files = " ".join(list_file)
cmd2 = "python3 %s -c %s -o %s %s" % (script_file,column,output_file,files)
os.system(cmd2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment