 <p>Are you sure it's an issue with imread? I'd be surprised if it is.</p> <p>See <a href="http://www.mathworks.com/help/toolbox/images/ref/medfilt2.html" rel="nofollow">this link about medfilt2</a> where it explains that "medfilt2 pads the image with 0s on the edges, so the median values for the points within [m n]/2 of the edges might appear distorted."</p> <p>EDIT: I tried to replicate your problem. This is an issue with <code>print</code> where it puts a white frame around the image after you save it. This functionality, <code>print</code> is made for printing plots. If you want to save the image, you should use <code>imwrite</code>.</p>