title: RMagick/ImageMagick error "no decode delegate for this image format" with Ruby Tempfile
body: <p>I'm having a problem using RMagick/ImageMagick to open a file uploaded through a Rails form. I believe this is due to the fact that Rails Tempfile behavior is to eliminate the file extension. From what I've read, ImageMagick should prefer to use magic number rather than file extension to detect the image file format, but that doesn't seem to be the case in my installation. I'm doing this:</p>
  
  <pre><code>img = Magick::Image.read(full_size_image.path)
  </code></pre>
  
  <p>where full_size_image is the Tempfile object returned from the upload form controller, which creates an error like: </p>
  
  <blockquote>
    <p>no decode delegate for this image format `/var/folders/uI/uIsldaxoHkiXKWYFuTWs4++++TI/-Tmp-/RackMultipart20101031-10144-1hiwlw-0' @ error/constitute.c/ReadImage/532</p>
  </blockquote>
  
  <p>This is happening on Mac OS X 10.6 with Rails 2.3.8, RMagick 2.13.1 and ImageMagick 6.6.5-5. I've confirmed that ImageMagick can convert the file I've been using to test through the upload form successfully, and that the tempfile path/file actually exists/is readable.</p>
  
  <p>I suspect that either a) something in my ImageMagick installation is somehow preventing it from using magic number to detect the file type (?? - getting ImageMagick working on Snow Leopard from source was an adventure itself) or b) there are just cases where this doesn't work and I somehow need to make Tempfile preserve the original file extension.</p>
  
  <p>I know that I can get the original file name from the Tempfile object, but I haven't found a way to rename the file. I suppose I could make some kludge where I use a File object and somehow create a copy of the Tempfile with the original extension on it, but that just seems unseemly. What's the right way to solve this problem?</p>
  
  <p>Thanks for your help.</p>