python - Converting specific rgb values -


i trying create code converting rbg values of specific pixels in picture. here code have far:

so have gotten far inputting new rgb values new color of pixel, stumped how input pixel. thanks, appreciated!

this came with.

from pil import image, imagefilter   print("enter image file:") myimage = input()  try:     original = image.open(myimage)     im = original.load() except:     print('invalid file')     # print(myimage)     # print("the size of image is: ")  print(original.format, original.size, original.mode)  # pixel_values = list(original.getdata())  ''' y in range(0, 512):     row = "" x in range(0, 512):     row = "" '''  print("enter coordinates of desired pixel in x,y form") coordinates = [int(x) x in input().split(',')] x, y = coordinates r, g, b = im[x, y] print("r,g,b values corresponding pixel are:") print(r, g, b)  print("enter new r,g,b values") new_rgb = [int(x) x in input().split(',')]  r, g, b = new_rgb  im[x, y] = (r, g, b)  original.save(myimage) 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -