Store image (jpg) in a variable - Delphi

0

I am having a question regarding storing an image in a variable in Delphi. I am using a function that saves as a picture a signature collected on a digital signature sink (Step Over - naturaSign). However, this function only saves the image to a directory on my machine. I would like to know how do I go up the directory path, grab this image and finally store it in a variable. Thanks in advance for the answers.

    
asked by anonymous 20.09.2018 / 16:08

1 answer

0

The class TPicture has the procedure LoadFromFile to load an image, to use it would look something like this:

function CarregarImagem(caminhoImagem: String): TPicture;
var
  picture: TPicture;
begin
  picture := TPicture.Create();
  picture.LoadFromFile(caminhoImagem);
  Result := picture;
end;

To use the method simply pass where the image is located:

var
  picture: TPicture;
begin
  picture := CarregarImagem('C:\teste.jpg');
end;
  

The class TPicture is located in unit Graphics

    
20.09.2018 / 16:20