Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.image as mpimg
- import matplotlib.pyplot as plt
- import numpy as np
- img = mpimg.imread("dw20.png")
- img = 15*img
- f = open("dw.txt","w")
- for r in range(len(img)):
- for c in range(len(img[0])):
- pixel = img[r][c]
- hexstr = "0x%0.2X%0.2X%0.2X" % (16*int(round(pixel[0])),16*int(round(pixel[1])),16*int(round(pixel[2])))
- f.write(hexstr)
- f.write("\n")
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement