From: Tim Hunter Date: 2008-08-26T04:46:30+09:00 Subject: Re: RMagick write fails / to_blob works Gaspard Bucher wrote: > I am trying to use @img.write(path) but it's not working (zero bytes > written). Using "to_blob" works. > > > f = Tempfile.new('tmp_img') > FAILING CODE: > @img.write(f.path) > > WORKING CODE: > File.open(f.path, 'wb') do |f| > f.syswrite(@img.to_blob) > end Image#write doesn't know what to do with a Tempfile object. It can only accept a string or a File object that's been opened for output. Image#write calls directly into ImageMagick, and ImageMagick doesn't know anything about Ruby objects like Tempfiles. -- Posted via http://www.ruby-forum.com/.