title: How do I optimize "ndarray to list" conversion for large number of image matrices?
body: <p>I am trying to convert image matrices to list, in order to send them as a request to an inference API.</p>
  <p>However, as most of my files are 100+ pages(I do pdf2img for getting images), the <code>.tolist()</code> operation takes a lot of time (Implementation below:)</p>
  <pre><code>page_images = [page.image.tolist() for page in pages]
  </code></pre>
  <p>This single line takes forever to run for 100+ page files.</p>
  <p><strong>Is there something that can be done to improve the speed?</strong></p>