#PIL
img.show("预览")
import matplotlib.pyplot as plt
fig = plt.figure('show picture')
plt.imshow(img)
plt.show()
import cv2
cv2.namedWindow('myPicture', 0)
cv2.resizeWindow('myPicture', 500, 500)
cv2.imshow('myPicture', img)
cv2.waitKey()
cv2.destroyWindow('myPicture')
with tempfile.TemporaryFile('wb+', suffix=".png") as f:
img.save(f)
print("f.name", f.name)
os.system(f"explorer {f.name}")
tmp_file = os.path.join(tempfile.gettempdir(), f"{time.time()}.png")
with open(tmp_file, 'wb') as f:
image.save(f)
os.system(f'start {tmp_file}') # start不阻塞哦
python打开图片的方式
于 2022-09-01 15:51:52 首次发布