title: np arrays being immutable - "assignment destination is read-only"
body: <p>FD** - I am a Python newb as well as a stack overflow newb as you can tell. I have edited the question based on comments.</p>
  
  <p>My goal is to read a set of PNG files, create Image(s) with Image.open('filename') and convert them to simple 2D arrays with only 1s and 0s. The PNG is of the format RGBA with mostly only 255 and 0 as values. Quite often in the images, the edges are grey scale values, which I would like to avoid in the 2D array. </p>
  
  <p>I created the 2D array from image using np.asarray(Image) getting only the 'Red' channel. In each of the 2d image array, I would like to set the cell value = 1 if the current value is non zero.</p>
  
  <p>So, I loop into the 2d array and I check the cell value and try to set it to 1.</p>
  
  <p>It gives me an error indicating that the array is read-only. I read through several stack overflow threads discussing that np arrays are immutable and it is a still bit unclear. I use PIL and numpy</p>
  
  <p>Thanks @user2314737. I will attempt to set that flag. 
  @Eric, thanks for your comments as well. </p>
  
  <pre><code>from PIL import Image
  import numpy as np
  </code></pre>
  
  <p>The relevant code:</p>
  
  <pre><code>prArray = [np.asarray(img)[:, :, 0] for img in problem_images]
  
  for img in prArray:
      for x in range(184):
          for y in range(184):
              if img[x][y] != 0:
                  img[x][y] = 1
  </code></pre>
  
  <p>The error "assignment destination is read-only" is in the last line.</p>
  
  <p>Thank you everyone for help. </p>