You guys rock !

Thanks very much. Adding 'jpeg:' prefix solved the problem. This  
solution is better because it keeps the temporary filename so the file  s still cleaned up.

Solution:

     tmp_path = Tempfile.new('tmp_img').path
     @img.write('jpeg:' + tmp_path)   # writes to tmp_path

Thanks !

Gaspard

Le 26 ao 08 00:47, Tim Hunter a rit :

> Serabe wrote:
>> Hi, Gaspard and Tim:
>> I've tried changing:
>> @img.write(f.path)
>> to
>> @img.write(f.path+'.jpg')
>> and it works. Maybe RMagick just needs to check if there is an
>> extension ImageMagick can use.
>> Cheers,
>> Serabe
>
> Duh. I had to figure this out just a few weeks ago. I should've  
> remembered. I must be getting old.
>
> The Tempfile path ends in .0, which is not an extension ImageMagick  an use. As Serabe so intelligently points out, adding a valid  
> extension works. You can also add a prefix: "jpeg:" + f.path.
>
> Thanks for being smarter than me, Serabe!
>
> -- 
> RMagick: http://rmagick.rubyforge.org/
>