blob: 2e7ad8c1309b2b4a1e02b424cbd74a610535a4ed [file] [log] [blame] [edit]
import math
import struct
from base64 import decodebytes
from tests.support.asserts import assert_png
def png_dimensions(screenshot):
assert_png(screenshot)
image = decodebytes(screenshot.encode())
width, height = struct.unpack(">LL", image[16:24])
return int(width), int(height)