title: Create a copy of an image - python
body: <p>I'm trying to read data from an image file and writing it to a new file - to make a copy.</p>
  
  <p>Here is my code to read the data of the original image and to write every byte to the new image:</p>
  
  <pre><code>file = open("image2.png", "w")
  with open("image.png", "rb") as f:
      while True:
          byte = f.read(1)
          if not byte:
              break
          file.write(byte)
  </code></pre>
  
  <p>Now, it does create a new file named "image2.png" but when I try to open it I get an error that says the image has been corrupted or damaged.</p>
  
  <p>How can I read the data of an image and writing it to a new file?</p>