Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. from PIL import Image
  2. import sys
  3.  
  4. if len(sys.argv) != 2:
  5. print "Usage: solvesteg.py filename"
  6. exit(1)
  7.  
  8. img = Image.open(sys.argv[1], "r")
  9. pix = img.load()
  10. width = img.size[0]
  11. height = img.size[1]
  12.  
  13. new_img = Image.new("L", (width, height))
  14. new_pix = new_img.load()
  15.  
  16. for x in range(width):
  17. for y in range(height):
  18. p = pix[x, y]
  19. hidden_pix = ((p[0] & 1) << 3) | ((p[1] & 1) << 2) | ((p[2] & 1) << 1) | p[3] & 1
  20. new_pix[x, y] = hidden_pix * 16
  21. new_img.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement