#!ruby # -*- mode: ruby; coding: utf-8 -*- # Last updated: <2022/08/18 06:57:23 +0900> # # Read image file, output base64 # # Windows10 x64 21H2 + Ruby 1.9.3 p551 i386-mingw32 # # Ruby 1.8.7 is not work infile = ARGV[0] bin_data = File.binread(infile) base64_text = [bin_data].pack("m") puts base64_text