I think the two lines above are incorrect.  m.width and m.height are the full size of the image, not the preview size.