Delphi 读取图像文件base64编码加载到Image组件显示图片


本文整理自网络,侵删。

 

uses EncdDecd;

 

function Base64ToImage(const base64: string;AImage: TImage):Boolean;

var

  Input: TStringStream;

  Output: TBytesStream;

begin

Result :=False;

  Input := TStringStream.Create(base64, TEncoding.ASCII);

  try

    Output := TBytesStream.Create;

    try //www.delphitop.com

      EncdDecd.DecodeStream(Input, Output);

      Output.Position := 0;

      try

        AImage.Picture.LoadFromStream(Output);

        if AImage.Picture.Graphic<>nil then

        begin

        Result :=true;

        end

        else

        begin

        Result :=false;

        end;

      except

        AImage.Free;

        raise;

      end;

    finally

      Output.Free;

    end;

  finally

    Input.Free;

  end;

end;

 

用法:

Base64ToImage(Memo1.Text,Image1); //Image1 为组件

 

Delphi 读取Image组件转换base64编码 http://www.delphitop.com/html/tuxiang/4535.html

相关阅读 >>

Delphi 中showmodal与show的区别

Delphi重写一个字符串分割函数

Delphi 的按位运算详解

Delphi 在firemonkey应用程序中使用torientationsensor获取设备倾斜和指南针航向

Delphi在手机桌面图标上显示数字

Delphi 7中使用加密的sqlite

Delphi中datetimepicker组件介绍

Delphi结构体指针的使用

Delphi获取本机或者网关的互联网ip地址

Delphi版的隐藏模块单元 hidemoduleunit.pas

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...