-2
def sample_stack(stack, rows=8, cols=8, start_with=1, show_every=1):
    fig,ax = plt.subplots(rows,cols,figsize=[12,12])
    for i in range(rows*cols):
        ind = start_with + i*show_every
        ax[int(i/rows),int(i % rows)].set_title('slice %d' % ind)
        ax[int(i/rows),int(i % rows)].imshow(stack[ind],cmap='gray')
        ax[int(i/rows),int(i % rows)].axis('off')
images = sample_stack(imgs_to_process)

after running this i dont want it to show but put the images into a folder

Sayse
  • 42,633
  • 14
  • 77
  • 146
  • Does this answer your question? [Save plot to image file instead of displaying it using Matplotlib](https://stackoverflow.com/questions/9622163/save-plot-to-image-file-instead-of-displaying-it-using-matplotlib) – Francisca Concha-Ramírez Dec 05 '19 at 17:28

1 Answers1

0

simply use plt.savefig() instead of plt.show():

plt.savefig(filepath)