Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A service to base64 encode external image links
JavaScript Python
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
static
templates
.gitignore
Procfile
README.md
bootstrap.py
requirements.txt
test.py

README.md

img64

A minimal Python server that can receive requests for external image links and encode them in the base64 format. This project was made in order to get around the canvas.toDataURL security exception.

As long as the requested image's Content-Length header is a reasonable size, the image will be encoded and the response will be a JSON object containing the data.

Bonus: External text and HTML can be encoded, too -- although the purpose remains base64 encoding images.

Usage

If you were using a JavaScript library like jQuery, you could get the encoding of an external image like so...

var image = "http://flask.pocoo.org/static/logo.png";

$.ajax({
  url: 'http://img64.com/?q=' + encodeURIComponent(image),
  dataType: 'jsonp'
}).then(function (data) {
  console.log(data)
})

For further instructions on usage, just visit the site.

http://img64.com

To encode images by visiting the site, pass the URL a q argument pointing to the image link.

http://img64.com/?q=https://si0.twimg.com/a/1321379639/phoenix/img/twitter_logo_right.png

Something went wrong with that request. Please try again.