Make it possible to set both width and height

Note that the sizes are maximum, width and heigh are controlled
by the ratio of dots.