A ruby script to import and decode base64 images.
$ gem install json
$ gem install open-uri
$ gem install data_uri
To import and decode http://myurl/image1.json
, http://myurl/image2.json
and http://myurl/image3.json
, use the slurp
function as follow :
slurp 'http://myurl', ['image1', 'image2', 'image3']
- The default json key is
dataUri
but you can pass another key as an argument to the decode function. - The default image extension is
.jpg
but you can pass another extension as an argument to the decode function.
I originally developed this script to fetch & decode images from Earth View from Google Maps.
You can run the script without changing it to run the example and get all the amazing Earth View from Google Maps images.
$ ./slurp.rb