Creating image file from base64 data [duplicate]
问题 This question already has answers here : Open and save base64 encoded image data URI in Ruby (4 answers) Closed 2 years ago . I have a base64 encoded image data . I am pasting the first few characters string='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD /2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopG R8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgo......' I am doing following to it in ruby decoded_string=Base64.decode64 string output_file =