Optimal resolution for imshow


Is there a way to find out the optimal resolution that an array (of a given
aspect ratio) should have, so that imshow will not re-scale it on a
pixel-based backend?

Some background: I'm preparing an array that has a native resolution, so for
PDF output I use imshow with interpolation='none'. For PNG-output, however,
the array has to be rescaled. I would prefer to prepare the array in the
correct resolution right away.

Thanks in advance,