I have got the RGB value of an image using PIL module, but I don't know how to modify the third value i.e (the Blue value )B value particularly . Help me with this>>??
Asked
Active
Viewed 15 times
-1
-
Welcome to stack overflow! Unfortunately, this question is not detailed enough to give you any meaningful help. Please edit your question to include a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) for the issue, including sample input, preferred output, and code for what you've tried so far. Also, since you have an error, please include the full error traceback in the text of the question. – E. Zeytinci Jan 14 '20 at 07:47
1 Answers
1
How to edit a pixel in a PIL image
from PIL import Image
im = Image.open('hopper.jpg')
px = im.load()
new_blue_value = 255
px[4,4] = (px[4,4][0], px[4,4][1], new_blue_value)
Because each pixel value is a tuple, you have to reassign all pixel values, as opposed to modifying a single color value

Inventoxz
- 11
- 3