ImageEn, unit imageenio

TImageEnIO.LoadFromText

TImageEnIO.LoadFromText


Declaration

function LoadFromText(const FileName: WideString; TextFormat: TIETextFormat = ietfBase64): Boolean;
function LoadFromText(Stream: TStream; TextFormat: TIETextFormat = ietfBase64): Boolean;


Description

Loads image from text.
Parameter Description
FileName Input file name
Stream Input stream
TextFormat Input text format. Only ietfBase64 is currently supported

Result is true if loading succeeded.

See Also: SaveToText


Examples

// save as base64 (inside there is a jpeg)
ImageEnView1.IO.LoadFromFile('image.jpg');
ImageEnView1.IO.SaveToText('image.base64', ioJpeg, ietfBase64);

// reload back
ImageEnView1.IO.LoadFromText('image.base64', ietfBase64);

// Save all pages of a Base64 encoded PDF file as JPEG
var
  iev : TImageEnView;
  idx : Integer;
begin
  // Check PDF library available (shows error if not found)
  IEGlobalSettings().PlugInAvailable([ iepiPDFium ], True );

  iev := TImageEnView.Create(nil);
  try
    iev.PdfViewer.Enabled := True;
    iev.IO.LoadFromText( 'D:\Base64Pdf.txt', ietfBase64 );
    idx := 0;

    Repeat
      iev.IO.SaveToFileJpeg( 'D:\PageOut_' + idx.ToString + '.jpg' );
      inc( idx );
    Until iev.IO.Seek( ieioSeekNext ) <> idx;

  finally
    iev.Free;
  end;
end;