diff --git a/autofilename.py b/autofilename.py index 598fae7..b49524e 100644 --- a/autofilename.py +++ b/autofilename.py @@ -81,8 +81,8 @@ class InsertDimensionsCommand(sublime_plugin.TextCommand): if '= 24) and data[:8] == b'\211PNG\r\n\032\n' and (data[12:16] == b'IHDR')): - content_type = 'image/png' w, h = struct.unpack(">LL", data[16:24]) width = int(w) height = int(h) # Maybe this is for an older PNG version. elif (size >= 16) and data[:8] == b'\211PNG\r\n\032\n': - print("we have a png2") # Check to see if we have the right content type - content_type = 'image/png' w, h = struct.unpack(">LL", data[8:16]) width = int(w) height = int(h) # handle JPEGs - # Can't get this method to work. # elif (size >= 2) and data[:2] == b'\377\330': - # content_type = 'image/jpeg' # jpeg = io.StringIO(olddata) + # print(bytes(ord(jpeg.read(1)))) # jpeg.read(2) # b = jpeg.read(1) # try: @@ -62,4 +58,4 @@ def getImageInfo(data): # except ValueError: # pass - return content_type, width, height \ No newline at end of file + return width, height