lundi 10 juillet 2017

How to assign a pixel a value, then get that value's coordinates

I'm only a couple weeks into my IT degree and I'm trying to write a small program in Python, I've tried searching for a solution but my knowledge of terminology and concepts is probably limiting my results. Saying that, I'm trying to find out if it is possible to assign a value to a pixel in a random range, then get the x,y of that value and manipulate it. For example

import random
pic=makeEmptyPicture(500,500)
w=random.randint(0,getWidth(pic))
h=random.randint(0,getHeight(pic))
a=getPixel(pic,w,h)
for x in range(getX(a),getX(a+5),1): #this is where I'm stuck.
    for y in range(getY(a),getY(a+5),1): #I need to get the x,y of "a"
        #Do something                    #and manipulate it.

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire