Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def rgb_to_gray_image(self):
- im = Image.open(self.im_name)
- im = im.convert('LA')
- return im
- # editing pixels of image to white
- def loop_over_image(self):
- im = Image.open(self.im_name)
- width, height = im.size
- # nested loop over all pixels of image
- temp = []
- for i in range(width):
- for j in range(height):
- temp.append((255,255,255))#append a tuple for the RGB channel values for each pixel
- image_out = Image.new(im.mode,im.size) #create a new image usig PIl
- image_out.putdata(temp) #use the temp list to create the image
- return image_out
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement