From: Gaspard Bucher Date: 2008-08-26T15:23:27+09:00 Subject: Re: RMagick write fails / to_blob works 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 is 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ût 08 à 00:47, Tim Hunter a écrit : > 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 > can 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/ >