blob: 6149ccccbe3252e5c1c2bc37ba3dd3103ffbf9b6 [file] [edit]
import base64
import math
import struct
from six import ensure_binary
from tests.support.asserts import assert_png
def png_dimensions(screenshot):
assert_png(screenshot)
image = base64.decodestring(ensure_binary(screenshot))
width, height = struct.unpack(">LL", image[16:24])
return int(width), int(height)