diff --git a/editor.py b/editor.py index d5640e4..5a0412a 100644 --- a/editor.py +++ b/editor.py @@ -10,6 +10,7 @@ import json import argparse import os from sauce import SAUCE +from PIL import Image from sahliEditorPython import sahlifile as SF @@ -37,7 +38,12 @@ def getdata(filedata, name): def getpicdata(filename): """extract picture data from filename""" - return 'todo.txt' + imagedata = Image.open(filename) + picdata = { + 'width': imagedata.width, + 'height': imagedata.height + } + return picdata def getansidata(filename): @@ -98,7 +104,12 @@ def main(args): if suf in ['png', 'jpg', 'jpeg', 'gif', 'PNG', 'JPG', 'JPEG', 'GIF']: stuff = getpicdata(dirfile) - a = 5 + entry = mysahli.blank_picture() + entry['width'] = stuff['width'] + entry['height'] = stuff['height'] + entry['file'] = i + entry['name'] = i + newdata.append(entry) elif suf in ['ans', 'ANS', 'BIN', 'bin', 'XB', 'xb']: stuff = getansidata(dirfile) entry = mysahli.blank_ansi()