if directory != "" and not os.path.exists(directory):
os.makedirs(directory)
image = misc.toimage(image, cmin=0, cmax=255) // to avoid range rescaling
misc.imsave(filename, image)
if print_console:
After Change
if len(image.shape) >= 3 and image.shape[2] == 3:
image = Image.fromarray(image, mode="RGB") // to avoid range rescaling (cmin=0, cmax=255)
else:
image = Image.fromarray(image) // to avoid range rescaling (cmin=0, cmax=255)
imageio.imwrite(filename, image)
if print_console: