2014-09-21 60 views
0

Rmagick文档不是最清楚的,我试过所有,但它不喜欢它?也许我误解Magick :: Info如何工作?更改图像文件名称rmagick

http://www.imagemagick.org/RMagick/doc/info.html

def crop_photo(url, x, y, w, h) 
image = Magick::ImageList.new 
urlimage = open(url) 
format = url.split('/')[-1].strip.split('?')[0].strip 
image.from_blob(urlimage.read) 
crop = image.crop(x,y,w,h) 
image = crop.to_blob 
    image.filename = format #doesn't work 
    self.filename = format #doesn't work 
end 

的帮助感激

回答

1

为了节省图像或ImageList中使用write方法:

image.write(new_filename)

+0

更改文件名我必须写? – 2014-09-21 12:05:55