Problem with imsave in matplotlib v1.0

Dear all,

Please find here a really really stupid script for example purpose..

I was developping some Image processing steps using matplotlib 0.99 and
everything worked find... However, I upgraded my tools yesterday, and
installed the 1.0.0 version.

The "imshow" still work fine and gives me the expected figure. BUT the same
matrix saved in a png file via the "imsave" method is leading to surprising
results... Looks like the colums and lines are shifted when the png is
beeing filled. (Clearly visible when comparing the result of imshow and
opening the produced "test.png" file).

Am I missing something stupid? Did something change between v0.99 and
v.1.00? I don't think so by looking the doc...

···

-----------------------------------------
import numpy as np
import matplotlib.pyplot as plt

test=np.array([[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3],[0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3]])
plt.figure()
plt.imshow(test)

plt.imsave("test.png",test)
------------------------------------------
Thanks a lot for your help, this is really a problem for my application.

Christophe
--
View this message in context: http://old.nabble.com/Problem-with-imsave-in-matplotlib-v1.0-tp29886608p29886608.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Christophe,

I do recall an off-by-one-pixel error being fixed at some point, but I don’t remember if that was before or after the version 1.0 release. Have you tried the latest matplotlib from SVN to see if the problem still persists?

Ben Root

···

On Tue, Oct 5, 2010 at 6:48 AM, Ensitof <ensieta.leroy@…2015…87…> wrote:

Dear all,

Please find here a really really stupid script for example purpose…

I was developping some Image processing steps using matplotlib 0.99 and

everything worked find… However, I upgraded my tools yesterday, and

installed the 1.0.0 version.

The “imshow” still work fine and gives me the expected figure. BUT the same

matrix saved in a png file via the “imsave” method is leading to surprising

results… Looks like the colums and lines are shifted when the png is

beeing filled. (Clearly visible when comparing the result of imshow and

opening the produced “test.png” file).

Am I missing something stupid? Did something change between v0.99 and

v.1.00? I don’t think so by looking the doc…


import numpy as np

import matplotlib.pyplot as plt

test=np.array([[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3],[0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3]])

plt.figure()

plt.imshow(test)

plt.imsave(“test.png”,test)


Thanks a lot for your help, this is really a problem for my application.

Christophe