title: In PHP (plphp), how can we manage a file stored in a bytea with Imagick?
body: <p>We are storing entire image files in PostgreSQL, using bytea columns. </p>
  
  <p>In PHP, am trying to open an image file from the bytea field (these stored as hex), then want to manipulate/convert the image using Imagick.</p>
  
  <p>Must the bytestream be converted out of hex to be manageable - in a file-like way - by Imagick? Is there any other secret sauce?</p>
  
  <p>I wouldn't be surprised if we had to read beyond the file header bits, either. Offending snippet is below:</p>
  
  <pre><code>// Decode image from hex?
  $image = new Imagick ($row['thewholefile']);
  // ERROR:  Uncaught exception 'ImagickException' with message 'Unable to read the file: /x0000000 (etc)
  </code></pre>