from PIL import Image
def CreationImage(image0):
dimx=image0.size[0]
dimy=image0.size[1]
image1=Image.new('RGB',(3*dimx,4*dimy),(0,0,0))
for i in range(dimx):
for j in range(dimy):
r,v,b=image0.getpixel((i,j))
image1.putpixel((i,j),(r,v,b))
image1.putpixel((i+dimx,j),(b,r,v))
image1.putpixel((i+2*dimx,j),(v,b,r))
image1.putpixel((i,dimy+j),(255 - r,255 - v,255 - b))
image1.putpixel((i+dimx,j+dimy),(r+v+b//3,r+v+b//3,r+v+b//3))
image1.putpixel((i+2*dimx,j+dimy),(255-((r+v+b)//3), 255-
((r+v+b)//3), 255-((r+v+b)//3)))
return image1
image_initiale="148.jpg"
image_ini=Image.open(image_initiale)
image_finale=CreationImage(image_ini)
image_finale.save("148a.jpg")
image_finale.show()