Skip to content

Instantly share code, notes, and snippets.

View jdugan's full-sized avatar

John Dugan jdugan

  • Future Fox AS
  • Oslo, Norway
View GitHub Profile
@jdugan
jdugan / README.md
Created October 5, 2017 07:52
Converting image data to a JSON-compliant string

Simple images can be POSTed to JSON API endpoints by converting the binary data to a Base64 encoded string.

The functions required to do should be available in all popular programming languages.

An example in Ruby is provided below.

Conversion Class

The folowing ruby class has two public functions. One to encode an image file as a base64 string; another to decode a base64 string into an image file.

@jdugan
jdugan / caracal-image-encoding-help.md
Last active August 6, 2021 12:32
Caracal Image Encoding

The following is step-by-step output of the process to convert an image to a base64 string. If you are having trouble using a local file with Caracal, following this procedure can be helpful in determining where things are going astray.


Download a known image

Download this image from the Caracal example project.

Open an interactive ruby session.

Keybase proof

I hereby claim:

  • I am jdugan on github.
  • I am mrfuturefox (https://keybase.io/mrfuturefox) on keybase.
  • I have a public key ASCv1k92DecDJIV3KkgU6CBbGCYThKSFvpQ9KHtz656E9Ao

To claim this, I am signing this object: