# Reading image file field data directly into RMagick

**URL:** <https://www.ruby-forum.com/t/reading-image-file-field-data-directly-into-rmagick/55809>\
**Category:** Rails\
**Created:** [March 24, 2006, 12:37am UTC](https://www.ruby-forum.com/t/reading-image-file-field-data-directly-into-rmagick/55809 "2006-03-24T00:37:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![feldpost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/d78d45/32.png) [@feldpost](https://www.ruby-forum.com/u/feldpost)\
**Post date:** [March 24, 2006, 12:37am UTC](https://www.ruby-forum.com/t/reading-image-file-field-data-directly-into-rmagick/55809/1 "2006-03-24T00:37:35Z")

</div>

I’m trying to read image data from an upload file field directly into  
an RMagick image object without having to temporally save the image  
file first. Assuming my file field param is assigned to @temp\_file, i  
tried RMagicks from\_blob method:

img = Magick::Image::from\_blob(@temp\_file.read)

But i get an error message saying that the blob is empty. I also  
tried feeding it the entire IOString object returned by the file  
field, but it can’t deal with it either. Anybody knows how this can  
be done? Thanks.

sebastian
