Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- from PIL import ImageFilter
- import numpy as np
- img = Image.open('poruka_u_boci.bmp')
- rgb = img.convert('RGB')
- orig_color = (0,0,255)
- replacement_color = (255,255,255)
- data = np.array(rgb)
- data[(data == orig_color).all(axis = -1)] = replacement_color
- img2 = Image.fromarray(data, mode='RGB')
- img2.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement