image-transform-fit-width

image-transform-fit-width is a compiled Lisp function in `image-mode.el'.

(image-transform-fit-width WIDTH HEIGHT LENGTH)

Return (w . h) so that a rotated w x h image has exactly width LENGTH.
The rotation angle is the value of `image-transform-rotation'.
Write W for WIDTH and H for HEIGHT. Then the w x h rectangle is
an "approximately uniformly" scaled W x H rectangle, which
currently means that w is one of floor(s W) + {0, 1, -1} and h is
floor(s H), where s can be recovered as the value of `image-transform-scale'.
The value of `image-transform-rotation' may be replaced by
a slightly different angle. Currently this is done for values
close to a multiple of 90, see `image-transform-right-angle-fudge'.