def test():
import PIL.Image
y, x = np.mgrid[0:256, 0:256]
z = np.ones((256,256)) * 128
img0 = np.dstack((x, y, z)).astype(np.uint8)
img1 = y.astype(np.uint8)
img2 = np.arange(256, dtype=np.uint8)
img3 = PIL.Image.open("pics/RGB.png")
img3 = np.array(img3)[:,:,0:3]
img4 = PIL.Image.open("pics/banff.jpg")
img4 = np.array(img4)[:,:,0:3]
img5, _ = (np.mgrid[0:1242, 0:1276] / 1242. * 255.).astype(np.uint8)
img6, _ = (np.mgrid[0:1007, 0:12] / 1007. * 255.).astype(np.uint8)
for i in (1, 2, 4, 8):
write_tiff("Test0_" + str(i) + ".TIF", img0, bit_depth=i)
write_tiff("Test1_" + str(i) + ".TIF", img1, bit_depth=i)
write_tiff("Test2_" + str(i) + ".TIF", img2, bit_depth=i)
write_tiff("Test3_" + str(i) + ".TIF", img3, bit_depth=i)
write_tiff("Test4_" + str(i) + ".TIF", img4, bit_depth=i)
write_tiff("Test5_" + str(i) + ".TIF", img5, bit_depth=i)
write_tiff("Test6_" + str(i) + ".TIF", img6, bit_depth=i)
评论列表
文章目录