title: Modify pixel values in tensorflow
body: <p>I am learning Tensorflow and Python. I tried reading an image from a file and then displaying that image using matplotlib. Here is my code.</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import tensorflow as tf    
  # read and decode the image
  image_contents = tf.read_file('elephant.jpeg')
  image = tf.image.decode_jpeg(image_contents, channels=3)
  
  with tf.Session() as sess:  
      img = sess.run(image)
      print(img)
      plt.axis('off')
      plt.imshow(img)
      plt.show()
  </code></pre>
  
  <p>This also prints a huge array which I understand are the RGB values for each pixel. Now I am trying to modify pixel values individually. I can modify all the pixel values at once using tf operations but I am not able to operate on individual pixel values.</p>
  
  <p>For example, I have been trying to make the image grayscale. So, I want to replace the R, G and B values with the average of R,G and B values of the pixel. How do I do that?</p>
  
  <p>I also want to know if I should be focussing on Python or Tensorflow?</p>