title: Encode an image with Feistel cipher and Python
body: <p>I'm trying to encode an image using the Feistel cipher. The idea was to take an image file, read byte per byte the image, encode every byte with my Feistel cipher, and re-create a new image with the encoded byte generated by the cipher.</p>
  <p>Unfortunately, I've found out most of the common image formats use headers that, once encoded, make the encoded image corrupted.</p>
  <p>Having a look at the PIL package I've found out the <code>PIL.Image.frombytes</code> function is able to create an image object given a <code>BytesIO</code> object. With the image object, I'm able to recreate the image with the <code>save</code> function</p>
  <p>My issue now is, how to open an image and read the actual image payload in bytes that I need to process with my Feistel cipher.</p>
  <p>If I use the code</p>
  <pre><code>with open('image.jpg', 'rb') as file:
      data = file.read()
  </code></pre>
  <p>I read the whole file, including the headers, which I don't need</p>