Generate METADATA_BLOCK_PICTURE for ogg/opus/speex

Embedded album art in Ogg format files according to the specifications requires a specific, slightly complicated data structure based on the one used by FLAC that closely resembles an id3v2.3 "APIC" frame, and not just a base-64-encoded picture file as many people believe.

You can find more detailed information about the specification here.

Given a jpeg or png image, this script will correctly generate the structure, base64-encode it, and present to you a "METADATA_BLOCK_PICTURE=(base64 data)" string that you can pass to oggenc, opusenc, vorbiscomment, or any other program that lets you edit arbitrary vorbiscomment metadata in ogg files. In opusenc, for example, put this script's output after a "--comment " argument.

Select a file to generate METADATA_BLOCK_PICTURE from below, optionally specify the type for the embedded image and press The Button.
Image File (jpeg or png):
Picture Type: