Expression painter:size() returns a Qt variant of class qt.QSize representing the size in pixels of the drawing surface. This does not depend on the transformation matrix but corresponds to the default coordinate system set by painter:initmatrix().

The same information can be obtained more conveniently using function painter:currentsize() or properties painter.width and painter.height.