Hi,

For given size of the map (in pixels) I'm trying to calculate the maximum scale for the map to still be in the shape of rectangle (not to have black areas in the corner).

What I do now is: I assume the Earth to be of spheric shape.
From the width and height of the expected result picture I calculate it's diameter of the circimscribed circle (circle whose edge touches the corners of the picture) in pixels. From the default DPI (96px/inch), I convert the diameter to inches and then to km. Let's call it diameter "d"
I assumed that the mean Earth "D" radius should be then fitted to the calculated value and it implies the scale equeal to the Earth's diameter devied by my calculated diameter (D/d). But this doesn't seem to be correct. My results wary and sometimes the globe fits whole into the result picture and sometimes not. I would be gratefull if anybody had an advice how to achieve this or point me to other source of information (I tried google but unsuccessfully).

Thanks!