title: adding a comment to a jpeg file using python
body: <p>I want to write a python program that adds a comment to a jpeg file. I've read that a comment in a jpeg file is signaled by the marker 0xfffe. Thus, can I just open the file and append this marker with whatever comment I want following it? My code looks something like this:</p>
  
  <pre><code>file = open("someimage.jpg", "a+b")
  file.write("\xff\xfeCOMMENT")
  file.close()
  </code></pre>
  
  <p>Does it matter if my comment is after the end of file marker (0xffd9)? Thanks!</p>