ImageEn, unit iexBitmaps

TIEBitmap.AsBase64

TIEBitmap.AsBase64


Declaration

property AsBase64: AnsiString;


Description

Returns an image as a Base64 encoded string (used for web based images).

Note:
The string will be prefixed with "image/XXX;base64,", where XXX is the image format
FileType will be used to specify the image format
The "image/XXX;base64,", is optional when setting AsBase64
An exception is raised when setting AsBase64 if the image could not be loaded
Reading and writing AsBase64 may give inconsistent values if the FileType is lossy, such as ioJPEG


Examples

// Get the image as a Base-64 encoded JPEG
bmp.FileType := ioJPEG;
base64str := bmp.AsBase64;

// Load the image from a Base-64 encoded string
ImageEnView1.IEBitmap.AsBase64 := 'image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQO' +
      'DwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAAR' +
      'CAAhADMDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRol' +
      'JicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3' +
      '+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5' +
      'OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIR' +
      'AxEAPwD6pooPSvmX9r7x5rehXGjaFoV/c6elxG9zcS27GN352qoccgfeJA9qAPpSWaONWLyIuBzk9K+dfg5rvja81+e7v31W90l0IDzKxjPzdVJ6/hXI/s8fFnUIbHUdG1UrdzWsLXltMygzOi8yRlv4' +
      'uOQTz1GemPSfAfiiZPAuiQxu2Bb9M4/iP9KTjeSOqjW9nQqLlTvZa9N3p9x7A+sxRxBnilU4+64AIrO/4SmGOfFwqrETjcrZK/WvP7jVppupJ+tYesXExQ7WIBBJrSyOK7Pf45UkRXVgVIyKK4Lw5fTt' +
      'odkTI3+rHeioLPQDXx5+2qry+NfD8caFn+wtgLyT857V7T4uPjDS7+drXUL+8tHkLIls0UciIe3zRFTjpXEyeJvF1vqM062TXiNGIimt2atIAOyyQkDHsVp2Fc+d/hat3p+vX9wLeQSppl0Y1dDhj5ZG' +
      'PfrXuXw2kuH8EaQ13G0U3lsuxkKEAMQMg/5PFVxP4m1TxML+7srK3sUVglpZWzJhiODvbk/oPauu0rQPEGosClusCEDBfLtnvnt+VLQd3bl6f1/myYMAvJ4qhqEyOjxId8rKQqrzknj8K7jTPhvJJhtT' +
      'unkz1XPH5Diuw0zwlpdgBst1Zh3IoFY5/wAO2kq6HZK6MGEYBFFd6sSIoVUAA6cUUDM++6Gubvfvt9aKKAK0H+uFdnpf+pWiigC9RRRQAUUUUAf/2Q==';


See Also

LoadFromText
SaveToText