title: read image from the database in python
body: <p>I wrote a code in python and I got the image from my computer as an object and now I want to get this image from MySQL database. Any idea how can I do it?</p>
  <p>Here is my code for getting the image before connecting to the database, I read the image from my folder as an object:</p>
  <pre><code>segimg = Image.open(&quot;result1.png&quot;) 
  segimg = segimg.convert(&quot;RGB&quot;)
  </code></pre>
  <p>I want to do the same but now from my database and here is the table of the desired image.</p>
  <blockquote>
  <p>Table: project</p>
  <p>project_name: varchar(25) (primary key)</p>
  <p>Image: longblob NOT NULL</p>
  </blockquote>
  <p>Any idea how can I do it, and thanks?</p>