如何在Ruby中保存base64编码文件?

如何在Ruby中保存base64编码文件?,ruby,image,base64,Ruby,Image,Base64,我正在尝试使用开放uri从internet下载图像。以下是代码: require 'open-uri' open('0RB2132__601_K3.jpg', 'wb') do |file| file << open('http://luxonline.luxottica.com/luxpics/watermarkedextranet/med?style=0RB2132__601_K3').read end 我在Firefox中打开互联网上的原始图像,检查后发现它是base6

我正在尝试使用开放uri从internet下载图像。以下是代码:

require 'open-uri'

open('0RB2132__601_K3.jpg', 'wb') do |file|
  file << open('http://luxonline.luxottica.com/luxpics/watermarkedextranet/med?style=0RB2132__601_K3').read
end
我在Firefox中打开互联网上的原始图像,检查后发现它是base64编码的图像


如何从此地址下载此图像?

使用您在OS X上的脚本,它可以作为一种魅力。所以你的错误可能在别的地方

Error interpreting JPEG image file (Improper call to JPEG library in state 200)