Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
from pickletools import uint8
import numpy as np
from PIL import Image

image=Image.open('flower.jpg')
arr=np.array(image)
#arr[:,:]=[,,0]

print(arr.shape)
print(arr.dtype)
print(arr.size)
print(arr)

img=Image.fromarray(arr)


#img.save('flowerr.png',arr)
img.show()


How to replace the color from blue to white?

What I have tried:

How to replace the color from blue to white only using numpy?
Posted
Updated 19-Aug-22 1:05am

1 solution

You need to get the actual structure of the image and find all the cells that contain the colour you want to change. And remember that there are many shades of blue. See Image Module - Pillow (PIL Fork) 9.2.0 documentation[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900