That image-rescaling code (which I've looked at a little more since
writing my last message here) seems to be a real dog's breakfast. There
are a couple of points where it seems to be testing for error conditions
in the very next line after that code that guarantees that the error
condition can't happen, and there are other points where a comment
explaining what's about do be done is followed by a line of code that
clearly does something else. I think those are signs it's been tweaked
and patched several times in the past, and it may be that the best thing
to do might be to simply rewrite those routines - not a project I had
contemplated as part of the map-image feature addition, but one I'm
willing to tackle if it turns out to be necessary.