1

I'm having a prolbme with plt library in python. I try to save a 256x256 image to 512x512 size using savefig.
When I save the image the dimensions are 394x394. Where does it comes from?

img = np.random.random((256,256))
fig = plt.figure(figsize=(8,8))
plt.axis('off')
plt.imshow(img,interpolation='bilinear',cmap = 'gray')
plt.show()
fig.savefig('test.png',bbox_inches='tight',pad_inches = 0,dpi = 64)
41 72 6c
  • 1,600
  • 5
  • 19
  • 30
  • Does this answer your question? [matplotlib savefig() size control](https://stackoverflow.com/questions/13073045/matplotlib-savefig-size-control) – 41 72 6c Jul 01 '21 at 07:21
  • 1
    I think this post may help you: [Specifying and saving a figure with exact size in pixels](https://stackoverflow.com/questions/13714454/specifying-and-saving-a-figure-with-exact-size-in-pixels) – Elliot Su Jul 01 '21 at 07:39

0 Answers0