SHARE
TWEET

PlenochniyMir

AltronZ Jul 18th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from PIL import Image
  2.  
  3. # открываем файл
  4. img = Image.open("media\JK.png")
  5.  
  6. # загружаем матрицу пикселей
  7. pixels = img.load()
  8.  
  9. for i in range(img.width):
  10.     for j in range(img.height):
  11.         r, g, b = pixels[i, j]
  12.  
  13.         a = (r+g+b)//3
  14.         r,g,b = a,a,a
  15.        
  16.         pixels[i, j] = (r, g, b)
  17.  
  18.  
  19. img.show()
  20.  
  21. #img.save("путь к файлу")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top